1
votes

I'm currently logging using serilog with rollOnFileSizeLimit and want to change the order of the files.

At present the order of the log files is as follows:

Oldest
log.txt
log1.txt
log2.txt
...
Youngest

I'd like to switch this round:

Oldest
...
log2.txt
log1.txt
log.txt
Youngest

I've read the configuration pages for both serilog and the file sink and this isn't listed as a possibility. Does anyone know if it is possible?

This is the configuration we're running:

.WriteTo.File(
     logFilePath,
     shared: true,
     fileSizeLimitBytes: 1024 * 1024,
     rollOnFileSizeLimit: true,
     retainedFileCountLimit: 100,
     outputTemplate: "{Timestamp:yyyy-MM-dd  HH:mm:ss.fff}..."
     )
1

1 Answers

2
votes

The Serilog.Sinks.File does not have this feature. The sequence is coded to be in ascending order.

If you want this feature, you could submit a pull-request, or create your own modified version of the sink.