Closed nblumhardt closed 4 years ago
This does not seem to be supported in the code for the rolling file sink, but I would like to be able to set the maximum file size per file, and toggle the sink to roll to a new file upon reaching the max. I would also like to be able to configure the maximum amount of days that the elastic search log shipper retains files for before deleting them.
This would allow me to keep 10 days of logs, each day spread over the amount of files needed based on file size maximum. Is there any support for such a feature on this package? Would you accept a pull request that enables it?
I do not think it is supported at the moment. Open for PR of course.
We have a very similar use case.
I can see that the alternate rolling file sink actually supports rolling files on date and size. From looking at the code of the log shipper I believe that support for multiple files per day is build into this and if we could have the sink support this as well we would have solved the problem.
I'm thinking of giving this a go and have thought about a couple of possible solutions:
Allow injection in of a custom sink either in the ElasticSearchOptions or as a parameter in the LoggerConfiguration extension. This would then be used in DurableElasticSearchSink which would mean that the DurableElasticSearchSink should support a generic sink as well as the default constructor using the RollingFileSink
Make a new Nuget package forking the existing Serilog.Sinks.Elasticsearch called Serilog.Sinks.Elasticsearch.RollingFileAlternate. This would require maintaining a separate repo but would not require any changes to the existing sink.
Any other ideas or input on how this can be achieved?
Old issue, cleaning up. Still facing this issue, feel free to reopen.
Old issue, cleaning up. Still facing this issue, feel free to reopen.
Moved from: https://github.com/serilog/serilog/issues/531