datalust/serilog-sinks-seq

Configuring SEQ sink to use a proxy server

mallibone opened this issue ยท 4 comments

Hi there ๐Ÿ‘‹

I could not find any information regarding this. Basically what I am trying to do is implement the SEQ sink and configure it to use a proxy to make the calls to the SEQ server. Ideally, this could be done via PAC file but also being able to manually configure the proxy would be great. How could this be done?

Hope I did not miss the docs part where this is already described. ๐Ÿ™ˆ And thanks for making SEQ. ๐Ÿ™‚

Hi Mark ๐Ÿ‘‹

WriteTo.Seq() accepts an HttpMessageHandler argument:

https://github.com/datalust/serilog-sinks-seq/blob/dev/src/Serilog.Sinks.Seq/SeqLoggerConfigurationExtensions.cs#L83

This allows proxy configuration, e.g.:

    .WriteTo.Seq(
        "https://seq.example.com",
        messageHandler: new HttpClientHandler
        {
            Proxy: new WebProxy("http://proxyserver:80/",true);
        })

Does this do the job for you?

Hi Nicholas

Thank you for the swift reply and for pointing this out. ๐Ÿ™‚ There would not also be a way to load the proxy configuration out of an appconfig.json file? ๐Ÿ˜‡

Hi Mark, I think the standard default proxy configuration mechanism should also work:

https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.defaultproxy?view=net-6.0#remarks

(I.e. setting through the ALL_PROXY environment variable.)

I'm not familiar with a JSON config approach, except to create and read your own config section, and then apply those settings in code.

Let me know if this helps!
Nick

Hi Nick

Thanks for all your help and hints. ๐Ÿ™‚ Thought I would take my chances since you might know how it could be done via config. With the pointers you provided I am sure we to find a good solution. ๐Ÿ‘๐Ÿป

Best
Mark