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
Nagios log rotation query
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios log rotation query
Log Rotation Method can only be set to one of the following
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.
https://assets.nagios.com/downloads/nag ... ion_methodFormat: 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)
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.