-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuration of multiple seq servers #42
Comments
Hi! It's been a little while since I used this syntax, but this should be what you need: <add key="serilog:using:FirstSeq" value="Serilog.Sinks.Seq" />
<add key="serilog:write-to:FirstSeq.serverUrl" value="http://localhost:5341" />
<add key="serilog:using:OtherSeq" value="Serilog.Sinks.Seq" />
<add key="serilog:write-to:OtherSeq.serverUrl" value="http://otherhost:5341"/> |
Thanks, that looks like it should work but it doesnt :( |
Sorry, that's me misremembering the features of Serilog.Settings.AppSettings. I think this is a limitation of the syntax. It's possible to use prefixes to work around it, i.e.: <add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
<add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
<add key="serilog-2:using:Seq" value="Serilog.Sinks.Seq" />
<add key="serilog-2:write-to:Seq.serverUrl" value="http://otherhost:5341"/> but this requires an additional I'll give this a bit more thought, it'd be nice to support this cleanly. |
Thanks for your help, I appreciate it. The intent is to have the server addresses configurable so my fallback is to create my own appsettings that contain the server addresses and then just reference them from code. I'd prefer the all config option but if not workable my fallback plan will at least achieve the outcome of a web administrator being able to change the servers in config without having to rebuild the code. |
I don't suppose there's any chance your test harness is missing a |
I'm also using Autofac for DI and have registered the logger according to |
Sorry, my mistake again - just checked the role of <add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
<add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
<add key="serilog2:serilog:using:Seq" value="Serilog.Sinks.Seq" />
<add key="serilog2:serilog:write-to:Seq.serverUrl" value="http://otherhost:5341"/> |
Awesome, that works. Thanks so much. |
Great 👍 - it's mentioned in the intellisense docs for the parameter, I found it in: https://github.com/serilog/serilog-settings-appsettings/blob/dev/src/Serilog.Settings.AppSettings/AppSettingsLoggerConfigurationExtensions.cs#L62 Cheers, |
If I want to write to two Seq servers I can do this in code by:
I'm not sure how I can do this in appSettings
If I configure like so:
It ends up only sending logs to otherhost as the key is the same so it overwrites the first one.
Is there away to make these settings unique so that it ends up sending logs to both servers?
The text was updated successfully, but these errors were encountered: