datalust/serilog-sinks-seq

Notification when eventBodyLimitBytes is reached?

altmank opened this issue · 1 comments

I noticed I am sometimes hitting the limit of eventBodyLimitBytes as part of logging Entity Framework Core queries that include large lists of parameters. It would be helpful to know when this happens, is there a way to capture that event and log it?

Additionally, logs after such an event also stop being sent even though they have a smaller body, is this normal?

Hi! If you specify eventBodyLimitBytes on the client side, you should get a message written through Serilog's SelfLog:

https://github.com/serilog/serilog-sinks-seq/blob/dev/src/Serilog.Sinks.Seq/Sinks/Seq/SeqSink.cs#L187

If you're careful to pick out only these notifications, and don't accidentally create an infinite loop by logging a large event in response, you can hook in via SelfLog.Enable() and record the event.

Oversized events shouldn't prevent further logging, unless you're using the sink in durable mode - can you share any more details of how you're configuring it?

Cheers,
Nick