Page 1 of 1

Nagios Log Rotation

Posted: Thu Sep 07, 2017 5:16 am
by mg00513682
Hi Team,

I would like to know about the nagios.log. I have noticed that every day logs are rotated at 23:59 and moved the directory archives. This logs are rotated every day as it is configured as "log_rotation_method=d".

Now my queries are:
1. How nagios does this process and where it is configured to do so.
2. I want to keep only 30 days files in archives and how can i achieve this.

Re: Nagios Log Rotation

Posted: Thu Sep 07, 2017 9:01 am
by scottwilkerson
mg00513682 wrote:1. How nagios does this process and where it is configured to do so.
This is managed withing the nagios process
mg00513682 wrote:2. I want to keep only 30 days files in archives and how can i achieve this.
Before I show you how to do it, I want to state that the archives are required for the availability as well as other reports to work.

That said, if you want to remove files older that 30 days you should be able to run the following on a cron

Code: Select all

find /usr/local/nagios/var/archives/nagios-*.log -mtime +30 -exec rm {} \;