Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A utility to compress rotated log files?

Tags:

zip

nlog

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 ?

like image 385
adams Avatar asked Nov 14 '22 12:11

adams


1 Answers

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" />
like image 67
Julian Avatar answered Dec 26 '22 00:12

Julian