log_event_handlers=0
log_archive_path=/usr/local/nagios/var/archives
log_external_commands=0
log_file=/usr/local/nagios/var/nagios.log
log_host_retries=1
log_initial_states=0
log_notifications=1
log_passive_checks=0
log_rotation_method=d
log_service_retries=1
use_syslog=1
nagios.log file stopped updating
Re: nagios.log file stopped updating
Zajil NMS
Re: nagios.log file stopped updating
Those settings look good.
The post from ssax,
The post from ssax,
Looks like that could be it. Someone could of setup log rotation for Sundays. Can you check to see if that is it?Do you have anything configured for nagios in /etc/logrotate.d or /etc/logrotate.conf? If so, please attach the files.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: nagios.log file stopped updating
PN :- this issue of nagios.log not updating ( not writing logs to nagios.log file only happens every sunday
"-rw-r--r-- 1 nagios nagios 0 Nov 8 03:23 nagios.log")
however npcd.log and perfdata.log are updating correctly
-rw-r--r-- 1 nagios nagios 2346347 Nov 8 09:41 npcd.log
-rw-rw-rw- 1 nagios nagios 6333040 Nov 8 09:41 perfdata.log
adding one more input for your reference we have added below in to nagiosxi cron job apart from other defaults cron jobs
"-rw-r--r-- 1 nagios nagios 0 Nov 8 03:23 nagios.log")
however npcd.log and perfdata.log are updating correctly
-rw-r--r-- 1 nagios nagios 2346347 Nov 8 09:41 npcd.log
-rw-rw-rw- 1 nagios nagios 6333040 Nov 8 09:41 perfdata.log
Code: Select all
[root@xx cron.d]# cd /etc/logrotate.d/
[root@xx logrotate.d]# ll
total 24
-rw-r--r-- 1 root root 103 Oct 16 2014 dracut
-rw-r--r-- 1 root root 185 Aug 15 2014 httpd
-rw-r--r-- 1 root root 871 Feb 12 2014 mysqld
-rw-r--r--. 1 root root 63 Apr 29 2013 nagiosxi
-rw-r--r-- 1 root root 309 Feb 5 2014 syslog
-rw-r--r-- 1 root root 87 Oct 16 2014 yum
[root@icnms logrotate.d]# more nagiosxi
/usr/local/nagiosxi/var/*log {
missingok
notifempty
}
[root@xx logrotate.d]#
more /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
# system-specific logs may be also be configured here.Code: Select all
[root@xx html]# more /etc/cron.d/nagiosxi
*/2 * * * * nagios /usr/local/nagiosxi/scripts/nagios.log.sh 2>&1
[root@xx html]# more /usr/local/nagiosxi/scripts/nagios.log.sh
#!/bin/bash
# rsync using variables
SOURCEDIR=/usr/local/nagios/var/nagios.log
DESTDIR=/usr/local/nagiosxi/html/nagios.log
rsync -avz --chmod=o-rwx -p $SOURCEDIR $DESTDIR
Last edited by tmcdonald on Mon Nov 09, 2015 12:36 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
Reason: Please use [code][/code] tags around long output
Zajil NMS
Re: nagios.log file stopped updating
At this point I need to ask the obvious question: Do you have anything running every Sunday that could affect this?
No matter how big or how small, changes to the system can have unintended effects. Any backups, security checks, scans, synchronizations, anything at all running on Sundays? Anything running on a remote system that you might be checking? It's possible something is sending back a ridiculous amount of data only on Sundays, or possibly a malformed packet.
No matter how big or how small, changes to the system can have unintended effects. Any backups, security checks, scans, synchronizations, anything at all running on Sundays? Anything running on a remote system that you might be checking? It's possible something is sending back a ridiculous amount of data only on Sundays, or possibly a malformed packet.
Former Nagios employee
Re: nagios.log file stopped updating
[root@ zops]# cd /etc/logrotate.d/
[root@ logrotate.d]# more syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/usr/local/nagios/var/perfdata.log
/usr/local/nagios/var/npcd.log
#/usr/local/nagios/var/nagios.log
after comment above line our issue resolved but we would like to know how npcd and perfdata working and updating
and when we select nagios.log to be rotated it require nagios service restart why ? can we have it nagios.log to be rotated same like npcd and perfdata without service restart
[root@ logrotate.d]# cd /usr/local/nagios/var/
-rw-r--r-- 1 nagios nagios 835329 Nov 25 10:59 nagios.log
-rw-r--r-- 1 nagios nagios 8182461 Nov 25 10:59 npcd.log
-rw-r--r-- 1 nagios nagios 10035929 Nov 1 03:21 npcd.log-20151101
-rw-r--r-- 1 nagios nagios 10151305 Nov 8 03:22 npcd.log-20151108
-rw-r--r-- 1 nagios nagios 10264681 Nov 15 03:44 npcd.log-20151115
-rw-r--r-- 1 nagios nagios 36414 Nov 22 04:43 npcd.log-20151122
-rw-rw-rw- 1 nagios nagios 6043045 Nov 25 10:59 perfdata.log
-rw-rw-rw- 1 nagios nagios 2308600 Nov 1 03:21 perfdata.log-20151101
-rw-rw-rw- 1 nagios nagios 7465434 Nov 8 03:22 perfdata.log-20151108
-rw-rw-rw- 1 nagios nagios 2138605 Nov 15 03:44 perfdata.log-20151115
-rw-rw-rw- 1 nagios nagios 7137458 Nov 22 04:43 perfdata.log-20151122
[root@ logrotate.d]# more syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/usr/local/nagios/var/perfdata.log
/usr/local/nagios/var/npcd.log
#/usr/local/nagios/var/nagios.log
after comment above line our issue resolved but we would like to know how npcd and perfdata working and updating
and when we select nagios.log to be rotated it require nagios service restart why ? can we have it nagios.log to be rotated same like npcd and perfdata without service restart
[root@ logrotate.d]# cd /usr/local/nagios/var/
-rw-r--r-- 1 nagios nagios 835329 Nov 25 10:59 nagios.log
-rw-r--r-- 1 nagios nagios 8182461 Nov 25 10:59 npcd.log
-rw-r--r-- 1 nagios nagios 10035929 Nov 1 03:21 npcd.log-20151101
-rw-r--r-- 1 nagios nagios 10151305 Nov 8 03:22 npcd.log-20151108
-rw-r--r-- 1 nagios nagios 10264681 Nov 15 03:44 npcd.log-20151115
-rw-r--r-- 1 nagios nagios 36414 Nov 22 04:43 npcd.log-20151122
-rw-rw-rw- 1 nagios nagios 6043045 Nov 25 10:59 perfdata.log
-rw-rw-rw- 1 nagios nagios 2308600 Nov 1 03:21 perfdata.log-20151101
-rw-rw-rw- 1 nagios nagios 7465434 Nov 8 03:22 perfdata.log-20151108
-rw-rw-rw- 1 nagios nagios 2138605 Nov 15 03:44 perfdata.log-20151115
-rw-rw-rw- 1 nagios nagios 7137458 Nov 22 04:43 perfdata.log-20151122
Zajil NMS
Re: nagios.log file stopped updating
You can setup nagios to rotate the nagios.log file so you do not have to use logrotate to do it for you.
Take a look at this setting in the nagios.cfg file. The d means to rotate the nagios.log file daily and it stores that file in this folder log_archive_path=/usr/local/nagios/var/archives.
Here is the description of the log_rotation_method
Since the nagios process can rotate it's own file, it needs to be restarted to create the file.
Take a look at this setting in the nagios.cfg file. The d means to rotate the nagios.log file daily and it stores that file in this folder log_archive_path=/usr/local/nagios/var/archives.
Code: Select all
log_rotation_method=dIf you want to setup the rotation to weekly, you would set that option to W.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)
Since the nagios process can rotate it's own file, it needs to be restarted to create the file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: nagios.log file stopped updating
yes we are having daily rotation in archive folder but we were trying to keep weekly as well any how we understood your point
every time after log rotation we have to restart nagios service correct us if in case wrong ?
thanks you can close this topic
every time after log rotation we have to restart nagios service correct us if in case wrong ?
thanks you can close this topic
Zajil NMS
Re: nagios.log file stopped updating
I don't believe you need to restart nagios after a log rotation unless you are changing the "log_rotation_method" option in the nagios.cfg. In this case, you will need to restart nagios so that changes can take effect.every time after log rotation we have to restart nagios service correct us if in case wrong ?
I will be locking this topic how. If you have any more issues/questions, please start a new thread. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!