Page 1 of 1

Nagios Log Archive error

Posted: Thu Jun 30, 2016 3:41 pm
by harsha.s.aryan
Hi,

Nagios Log is not getting archive

Please let me know how to resolve

there is no archives directory created under /usr/local/nagios/var/

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:07 pm
by tgriep
Can you run the following commands and post the output here?

Code: Select all

ls -l /usr/local/nagios/var/
ls -l /usr/local/nagios/var/archives
Can you post your nagios.cfg file so we can check the log rotation settings?

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:22 pm
by harsha.s.aryan
root@Nagios:~# ls -l /usr/local/nagios/var/
total 41060
-rw-r--r-- 1 nagios nagios 34 Jul 1 01:59 nagios.configtest
-rw-r--r-- 1 nagios nagios 6 Jul 1 00:03 nagios.lock
-rw-r--r-- 1 nagios nagios 40538731 Jul 1 01:59 nagios.log
-rw-rw-r-- 1 nagios nagios 13460 Sep 10 2015 nagios.tmp5f4sAZ
-rw-rw-r-- 1 nagios nagios 13468 Sep 14 2015 nagios.tmpZBA7pf
-rw-r--r-- 1 nagios nagios 312362 Jul 1 01:59 objects.cache
-rw-r--r-- 1 nagios nagios 312362 Jul 1 01:59 objects.precache
-rw------- 1 nagios nagios 409496 Jul 1 01:59 retention.dat
drwxrwsr-x 2 nagios nagcmd 4096 Jul 1 01:59 rw
drwxrwxrwx 3 nagios nagios 4096 Sep 10 2015 spool
-rw-rw-r-- 1 nagios nagios 407353 Jul 1 02:51 status.dat
root@Nagios:~#


and


root@Nagios:~# ls -l /usr/local/nagios/var/archives
ls: cannot access /usr/local/nagios/var/archives: No such file or directory
root@Nagios:~#

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:31 pm
by tgriep
The archive folder is gone for sure.
Run this to create is and set the permissions.

Code: Select all

mkdir /usr/local/nagios/var/archives 
chown  nagios.nagios  /usr/local/nagios/var/archives 
chmod 775  /usr/local/nagios/var/archives 
Check these settings in the nagios.cfg file for the archive folder and to setup daily log rotation.

Code: Select all

log_archive_path=/usr/local/nagios/var/archives
log_rotation_method=d
If you have to change these settings, restart nagios by running

Code: Select all

service nagios restart

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:46 pm
by harsha.s.aryan
Still i am getting same error

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:50 pm
by tgriep
The archives get created at midnight so you will have to wait until tomorrow for the first archive file to be created.

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 4:54 pm
by harsha.s.aryan
is there any option to separate log file manually

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 5:01 pm
by tgriep
Do you mean that your nagios.log file has all of the data in it since the server was running?

Re: Nagios Log Archive error

Posted: Thu Jun 30, 2016 6:09 pm
by harsha.s.aryan
yes

Re: Nagios Log Archive error

Posted: Tue Jul 05, 2016 9:44 am
by tgriep
I found this example that you can try out for splitting the file.
http://stackoverflow.com/questions/2667 ... s-log-file