Open
Description
Hello
lately i was trying to implement some configuration which tries to push logs to S3 bucket, every full hour where every log is in one file. Log is generated by a windows service so it runs non stop.
Code that i use:
logger.WriteTo.AmazonS3(
restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug,
path: $"{fileName}.log",
bucketName: "BucketName",
endpoint: RegionEndpoint.EUCentral1,
bucketPath: "BucketPath",
awsAccessKeyId: "AccessKey",
awsSecretAccessKey: "SecretKey",
rollingInterval: Serilog.Sinks.AmazonS3.RollingInterval.Hour,
eagerlyEmitFirstEvent: false,
formatter: new Serilog.Formatting.Json.JsonFormatter(),
batchingPeriod: TimeSpan.FromHours(2),
batchSizeLimit: 10000
)
BatchPeriod and batchSizeLimit are used to make sure that every event is logged in same batch and finally be saved in same file.
Issue here is rollingInterval, which makes correct file names, however acts like it is set to infinity. Log files are pushed in the middle of hour (e.g. 11:30), and another file appear with suffix _001.
Debugging showed that:
logger._logEventSinks[0]._sink._batchedLogEventSink.amazonS3Options.RollingInterval = Infinite
Can I use rolling interval and batching configuration in that way? Perhaps it is a bug here?
Thanks in advance.