Reputation: 5368
I'm using Serilog and Serilog.Sinks.Seq to send events to Seq. Some events are arriving in the Seq log, but some are missing.
How can I ensure that all events sent during execution of my Lambda function arrive in Seq?
Upvotes: 2
Views: 1069
Reputation: 5368
Serilog buffers events for performance reasons, so if an application exits suddenly it can fail to forward all the log entries, as you suggested.
Before your lambda function completes try calling Log.CloseAndFlush();
to ensure any buffered events are processed before the application exits. If you are using ILogger instead of the static Log class then you will need to dispose the ILogger instead of calling CloseAndFlush()
.
Serilog's Lifecycle of Loggers page provides more detail if you are interested.
Upvotes: 2