Page 1 of 1

Log rotate not working for /drbd/nagios/var/archives

Posted: Sun Nov 21, 2021 1:26 am
by mejokj
Hi Team,

We need to do a log rotation for directory"/drbd/nagios/var/archives" as the disk is getting filled very often.

Need to know how to do it and will it create any impact or data loss if we do a log rotate on /drbd/nagios/var/archives directory.

Please suggest.

[root@nagios archives]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 150G 34G 117G 23% /
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 39M 16G 1% /dev/shm
tmpfs 16G 1.6G 15G 11% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/mpatha1 1014M 200M 815M 20% /boot
/dev/mapper/centos-var 30G 24G 6.1G 80% /var
/dev/drbd0 188G 127G 62G 68% /drbd
tmpfs 3.2G 0 3.2G 0% /run/user/1003
tmpfs 3.2G 0 3.2G 0% /run/user/1001
tmpfs 3.2G 0 3.2G 0% /run/user/0
You have new mail in /var/spool/mail/root
[root@qy-nagios-a archives]#


Thanks

Re: Log rotate not working for /drbd/nagios/var/archives

Posted: Mon Nov 22, 2021 10:36 am
by gsmith
Hi

/usr/local/nagios/var/nagios.log
The Nagios Core log, includes checks, notifications, external commands, and events. This file is rotated
daily into the /usr/local/nagios/var/archives folder (default setting in nagios.cfg) by rsyslog.
Logs located in the /usr/local/nagios/var/archives folder are used as the data source for the
Availability and SLA reports. Deleting them would cause these reports to show inaccurate data.

https://assets.nagios.com/downloads/nag ... ptions.pdf

What does this show:

Code: Select all

ls -l /drbd/nagios/var/archives
It should have one log for each day:

Code: Select all

-rw-r--r--  1 nagios nagios   3633 Oct  1 23:10 nagios-10-02-2021-00.log
-rw-r--r--  1 nagios nagios   3633 Oct  2 23:10 nagios-10-03-2021-00.log
-rw-r--r--  1 nagios nagios   3633 Oct  3 23:10 nagios-10-04-2021-00.log
-rw-r--r--  1 nagios nagios   6236 Oct  4 23:16 nagios-10-05-2021-00.log
-rw-r--r--  1 nagios nagios   3633 Oct  5 23:16 nagios-10-06-2021-00.log
-rw-r--r--  1 nagios nagios   3633 Oct  6 23:16 nagios-10-07-2021-00.log
If you do:

Code: Select all

head nagios-11-17-2021-00.log
you can see if the log rotations is being used:

Code: Select all

[1637038800] LOG ROTATION: DAILY
[1637038800] LOG VERSION: 2.0
[1637038800] CURRENT HOST STATE: 192.168.23.84;UP;HARD;1;OK - 192.168.23.84 rta 5.158ms lost 0%
[1637038800] CURRENT HOST STATE: 192.168.23.87;UP;HARD;1;OK - 192.168.23.87 rta 8.070ms lost 0%

You could try using an NFS mount for /drbd/nagios/var/archives but if you have issues with the I/O on the
NFS some of the reports may take a very long time to run .

Thanks