Fail-over to a second server if the first is unreachable
See original GitHub issueIf the attempt to send events to the primary Seq server fails, the sink could be configured to try a secondary Seq server, or more conveniently, a Seq Forwarder that will persist the events and transmit them back to the primary server once it’s available.
For example:
Log.Logger = new LoggerConfiguration()
.WriteTo.Seq(...
secondaryServerUrl: "https://some-seq-forwarder",
secondaryApiKey: "789078907890789")
.CreateLogger();
Some questions:
- Would this happen immediately, or would it be triggered after some number of failed retries?
- An alternative might be to accept an array of server/API key pairs, however this won’t be as friendly to use from app settings. Is more than one secondary server necessary?
- Assuming that 4xx errors would not fail-over - certainly this would make sense for 400, but what about 404, 401?
- Could the sink somehow signal that it was in failed-over mode, e.g. by adding an event or property, or would a prolonged fail-over be detected by other means (perhaps by attaching a property through the secondary forwarder?)
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
When does a Windows client stop using a secondary DNS ...
Note that this failover only happens when a server is not reachable, not when the queried record is not resolvable. If the primary...
Read more >DNS Failover: Basic Concepts and Limitations - NS1
If the first IP does not respond, it will wait 30 seconds and try the successive IPs in the list. This enables failover,...
Read more >What is the log backup behaviour after AG failover or other ...
But when the secondary is unreachable either due to network issue or post failover, then I'm learning that log keep growing (because it ......
Read more >Delete a DHCP Failover relationship when the partner server ...
This could happen if you take the server to another physical location which is not connected via the network/dhcp or makes it unreachable....
Read more >Troubleshooting automatic failover problems - SQL Server
This article provides troubleshooting steps for problems that occur during automatic failover in SQL Server.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just some more thoughts …
Maybe a more “general” way would be to wrap it all , something like this :
The idea being that the
w
inTry(w => w)
,ThenTry(w => w)
is a special kind ofSinkConfiguration
that specific sinks could light up when they support fallback … (i.e. they provide a way to detect that the destination is currently unavailable).And then there’s the question of
AuditTo
… should it also support failover and what would that look like ?Hi @kevingates!
IBatchedLogEventSink
now exists in Serilog.Sinks.PeriodicBatching, and I think we’re happy enough with the shape of it that it could move to Serilog if needed:https://github.com/serilog/serilog-sinks-periodicbatching/blob/dev/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/IBatchedLogEventSink.cs
There’s no official
FallbackSink
out there that I know of, but I suspect that one could now be hacked together as a proof-of-concept for sinks that already supportIBatchedLogEventSink
(like the Seq one, email, and several others) usingLoggerSinkConfiguration.Wrap()
, which provides a sneaky way to get at theILogEventSink
behind friendlyWriteTo
configuration methods, and a dose of good-old private reflection to pick upPeriodicBatchingSink
’s_batchedLogEventSink
field:https://github.com/serilog/serilog-sinks-periodicbatching/blob/dev/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs#L45
A PoC that demonstrated the API and mechanics (either as a gist or example nupkg) would help zoom in on any potential issues, illustrate the API possibilities, and might be enough for us to open up some minimal extension points to make this all possible (either via Serilog.Sinks.PeriodicBatching, or with some core APIs).
HTH!