How do I implement this desired log rentention?


#1 mburgess

New to nxlog and have it deployed on several test systems.

I have multiple logs under C:\Program Files\nxlog\data called which combined are more than 27GB of data.

nxlog.log.1
nxlog.log.2
nxlog.log.3 
and so on...

Are these the logs that are generated by om_file module? How do I rotate these? I've read the documentation, but am a little confused. I've outlined the criteria that I'm wanting to implement for log retention - any help is much appreciated.

Desired Retention Criteria

  • Each log file is 100mb in size
  • No more than 5 log files
  • Anything beyond that is deleted
#2 ArkadiyDeactivated Nxlog ✓
#1 mburgess
New to nxlog and have it deployed on several test systems. I have multiple logs under C:\Program Files\nxlog\data called which combined are more than 27GB of data. nxlog.log.1 nxlog.log.2 nxlog.log.3 and so on... Are these the logs that are generated by om_file module? How do I rotate these? I've read the documentation, but am a little confused. I've outlined the criteria that I'm wanting to implement for log retention - any help is much appreciated. Desired Retention Criteria Each log file is 100mb in size No more than 5 log files Anything beyond that is deleted

Hello,

Usually there is internal NXLog logs are placed in this file. But could I see your config to be sure?

Regarding logs rotation you could use code like this:

<Extension _fileop>
    Module xm_fileop

    # Check the log file size every hour and rotate if larger than 100 MB
    # Also no more than five previous files are stored simultaneously
    <Schedule>
        Every 1 hour
        <Exec>
            if (file_exists('%LOGFILE%') and file_size('%LOGFILE%') >= 100M)
                file_cycle('%LOGFILE%', 5);
        </Exec>
    </Schedule>
</Extension>

Regards, Arch