I am using Serilog to create log files in C#/.NET. Now there is a task to create a new instance of the log file if fileSizeLimitBites is full and the request is to limit it to 5 log files, if the fifth file is full there is no need to create a sixth, seventh... I've tried with "retainedFileCountLimit": 5 but with this deletes all old files from the folder where the logs are stored. I don't want to delete the old files, I want to keep the old files in the folder and not touch them and create 5 new instances of the log files. Does anyone know how to do this? Is that possible? Create 5 log instances and keep the old files?
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Seq" ],
"Default": "Debug",
"MinimumLevel": {
"Default": "Information",
"Override": {
"Serilog.AspNetCore.RequestLoggingMiddleware": "Information",
"Microsoft": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"System": "Warning",
"Microsoft.AspNetCore.Authentication": "Information"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "..\\logs\\log-rfzo-test-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": "10240",
"rollOnFileSizeLimit": true,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] {Message}{NewLine}{Exception}"
}
}
I have tried with retainedFileCountLimit: 5, retainedFileCountLimit: 5 and 'null'