serilog-sinks-http icon indicating copy to clipboard operation
serilog-sinks-http copied to clipboard

Bufferfile is not processed after deployment.

Open Roeland54 opened this issue 2 years ago • 5 comments

We are using the time rolled buffers on a application hosted in an azure appservice. The BufferRollingInterval is set to "HOUR" After the deployment of a new version we do not receive logs until the next rollover.

I have notice the following:

  • Bufferfile before deployment: "Bufferfile-2022102614.txt"
  • The deployment triggers the creation of a new file: "Bufferfile-2022102614_001.txt"

This file is never picked up by the LogShipper, seams like it is ignored. The bookmarkfile keeps pointing to the "Bufferfile-2022102614.txt" file. This automatically gets resolved when the next file is created "Bufferfile-2022102615.txt" The ignored files are also not automatically removed.

Using v8.0.0 Any idea on how to fix this?

Roeland54 avatar Oct 26 '22 14:10 Roeland54

Hi there and welcome to this repository!

A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it.

github-actions[bot] avatar Oct 26 '22 14:10 github-actions[bot]

Hi @Roeland54 and thank you for reporting the issue. The behaviour here is indeed erroneous, but not because the log events from Bufferfile-2022102614_001.txt aren't sent but because the file is even created in the first place. From Durable time rolled HTTP sink we read:

The maximum size of a buffer file is defined by bufferFileSizeLimitBytes, and when that limit is reached all new log events will be dropped until a new interval is started.

Can you show me your sink configuration?

FantasticFiasco avatar Oct 27 '22 06:10 FantasticFiasco

This is my configuration. I do not define "bufferFileSizeLimitBytes". The file size is also very small when this happens.

 Log.Logger = new LoggerConfiguration()
                        .WriteTo.DurableHttpUsingTimeRolledBuffers(
                            requestUri: "https://logstash.domain.com:1125",
                            bufferBaseFileName: "Bufferfile",
                            bufferRollingInterval: Serilog.Sinks.Http.BufferRollingInterval.Hour,
                            httpClient: new BasicAuthenticatedHttpClient(configuration.GetSection("Serilog:Settings:AuthenticationSettings").Get<AuthenticationSettings>()),
                            configuration: configuration)
                         .CreateLogger();

Roeland54 avatar Oct 27 '22 07:10 Roeland54

Thanks! I'll look into this, hopefully starting next week.

FantasticFiasco avatar Oct 28 '22 06:10 FantasticFiasco

I have set "bufferFileShared" to "true". The issue seams to be resolved now. The File sink is automatically creating these _001 postfix files when the file is locked/ in use.

Roeland54 avatar Nov 08 '22 15:11 Roeland54