cocowalla / serilog-sinks-file-gzip

Plugin for the Serilog File sink that compresses output using streaming GZIP
Apache License 2.0
12 stars 1 forks source link

Feature request: zip old rolling file #1

Closed adoris123 closed 4 years ago

adoris123 commented 4 years ago

It will be nice if only old files are gzipped and current log files leaves as is, unzipped. As option for existing functionality. Thanks for super plugin!

cocowalla commented 4 years ago

Hmm, so, I'm not sure if that's going to be possible using FileLifecycleHooks.

There are 2 ways in which you can do compression:

  1. Streaming compression, as the file is written
  2. Compressing already written, rolled, closed files

This plugin implements the first one, as FileLifecycleHooks enables wrapping the original stream. You can find some discussion about this over in this issue.

cocowalla commented 4 years ago

Just a note to say there is now also another plugin available, serilog-sinks-file-archive. It doesn't work quite how you describe, but it is similar.

As files drop out of retention, Serilog's rolling file mechanism usually deletes them, but this serilog-sinks-file-archive lets you archive them instead (copy and/or compress).