Page 1 of 1

Nagios log rotation query

Posted: Sat Dec 15, 2018 2:23 am
by rituraj966323
Hi Team,

I would like to know about the nagios.log. I have noticed that every hour logs are rotated and moved the directory archives. This logs are rotated every hour as it is configured as "log_rotation_method=h".

-rw-r--r-- 1 nagios nagios 219K Dec 15 10:59 nagios-12-15-2018-11.log
-rw-r--r-- 1 nagios nagios 249K Dec 15 11:59 nagios-12-15-2018-12.log
[root@prod-nagios archives]#


Now my queries is:
2. I want to roatate logs for ever 15 minutes and keep retention for 30 days.

Regards,
Rituraj

Re: Nagios log rotation query

Posted: Mon Dec 17, 2018 4:16 pm
by scottwilkerson
Log Rotation Method can only be set to one of the following
Format: log_rotation_method=<n/h/d/w/m>
Example: log_rotation_method=d

This is the rotation method that you would like Nagios to use for your log file. Values are as follows:

n = None (don't rotate the log - this is the default)
h = Hourly (rotate the log at the top of each hour)
d = Daily (rotate the log at midnight each day)
w = Weekly (rotate the log at midnight on Saturday)
m = Monthly (rotate the log at midnight on the last day of the month)
https://assets.nagios.com/downloads/nag ... ion_method

And nagios doesn't have any mechanism to remove logs as they are required to calculate availability data, if you want to remove old logs, you would need to write a a script and setup a cron to perform this action.