Nagios mangles its own logrotate file

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
User avatar
GldRush98
Posts: 257
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Nagios mangles its own logrotate file

Post 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...
Prod XI: Debian 12 - Nagios XI 2024R2.1
Dev XI: Debian 12 - Nagios XI 2026R1
danderson

Re: Nagios mangles its own logrotate file

Post 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
Post Reply