Nagios Log Rotation

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mg00513682
Posts: 6
Joined: Fri Aug 11, 2017 10:06 am

Nagios Log Rotation

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Log Rotation

Post 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 {} \;
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked