Page 1 of 1

Nagios mangles its own logrotate file

Posted: Fri Jul 28, 2023 3:19 pm
by GldRush98
It looks like the latest version of XI is mangling the heck out of the nagiosxi logrotate file. After looking in to a disk space consumption issue I found that log files haven't been rotated in months. This is how the file sits on multiple systems I have checked, so there is a bug some where in the install that seems to not be replacing values for the logrotate file:

/etc/logrotate.d/nagiosxi

Code: Select all

PRODDIR/var/*log {
    missingok
    notifempty
    size 5M
    copytruncate
    su NAGIOSUSER NAGIOSGROUP
    rotate 1
    compress
}

PRODDIR/var/xidebug.log {
    missingok
    notifempty
    size 100M
    copytruncate
    create 0660 APACHEUSER NAGIOSGROUP
    su APACHEUSER NAGIOSGROUP
    rotate 1
    compress
}

PRODDIR/var/xidebug.log.backtrace {
    missingok
    notifempty
    size 100M
    copytruncate
    create 0660 APACHEUSER NAGIOSGROUP
    su APACHEUSER NAGIOSGROUP
    rotate 1
    compress
}

PRODDIR/var/components/auditlog.log {
    missingok
    notifempty
    size 100M
    copytruncate
    create 0660 APACHEUSER NAGIOSGROUP
    su APACHEUSER NAGIOSGROUP
    rotate 1
    compress
}

PRODDIR/tmp/phpmailer.log {
    missingok
    notifempty
    size 100M
    copytruncate
    create 0660 APACHEUSER NAGIOSGROUP
    su APACHEUSER NAGIOSGROUP
    rotate 1
    compress
}


I've already fixed my file and logrotate is working again, but anyone who's installed the latest version probably has a broken logrotate and growing log files now...

Re: Nagios mangles its own logrotate file

Posted: Fri Aug 11, 2023 10:00 am
by danderson
Hey @GldRush98, thanks for posting and I'm glad you were able to resolve the issue on your own.

There were some changes to the logrotate file with the 5.9.4 update and a sed was not added to the upgrade script to change those values. It has since been added. Here's the fix just in case:

Code: Select all

. /usr/local/nagiosxi/etc/xi-sys.cfg
sed -i "s|APACHEUSER|$apacheuser|;s|NAGIOSGROUP|$nagiosgroup|;s|NAGIOSUSER|$nagiosuser|;s|PRODDIR|$proddir|" /etc/logrotate.d/nagiosxi