adams
adams

Reputation: 606

A utility to compress rotated log files?

I'm using NLog for logging and need to zip the loads of rotated text files it's generating shortly after they are created.

NLog should support this feature some time in the unknown future, but is there a utility of sorts that can do this independently ?

Upvotes: 5

Views: 1129

Answers (1)

Julian
Julian

Reputation: 36780

Zipping archive files is supported since NLog 4.0, see news post

Use enableArchiveFileCompression, e.g.

<target name="file" xsi:type="File"
      layout="${longdate} ${logger} ${message}" 
      fileName="${basedir}/logs/logfile.txt" 
      archiveFileName="${basedir}/archives/log.{#}.txt"
      archiveEvery="Day"
      archiveNumbering="Rolling"
      maxArchiveFiles="7"
    enableArchiveFileCompression="true" />

Upvotes: 2

Related Questions