NagiosXI logrotate not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
elpakko
Posts: 14
Joined: Fri Mar 22, 2019 1:07 am

NagiosXI logrotate not working

Post by elpakko »

I read somewhere that NagiosXI should have automatic Logrotation feature. I have noticed that perhaps the logrotate is not working, because my log files are getting big. I have not touched the logrotate conf files, but is there something I should configure for the logrotate to start working?

The settings are at the moment:

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
}

When I run

"logrotate -d /etc/logrotate.d/nagiosxi"

I get:

reading config file /etc/logrotate.d/nagiosxi
error: /etc/logrotate.d/nagiosxi:1 unknown option 'PRODDIR' -- ignoring line
error: /etc/logrotate.d/nagiosxi:6 unknown user 'NAGIOSUSER'
User avatar
lgute
Posts: 420
Joined: Mon Apr 06, 2020 2:49 pm

Re: NagiosXI logrotate not working

Post by lgute »

Hi @elpakko, thanks for reaching out.

What version of XI are you using and what OS & version? There have been a few fixes released lately that may address this issue for you.

This post may also address the issues you are having.
Please let us know if you have any other questions or concerns.

-Laura
elpakko
Posts: 14
Joined: Fri Mar 22, 2019 1:07 am

Re: NagiosXI logrotate not working

Post by elpakko »

Hi, thanks for your message.

I'm using the latest NagiosXI version 5.11.3 and Ubuntu 22.04 LTS with all the latest updates installed. I think this problem has been around for awhile, because sysstat.log is more than 13G in size.
elpakko
Posts: 14
Joined: Fri Mar 22, 2019 1:07 am

Re: NagiosXI logrotate not working

Post by elpakko »

@lgute

Any ideas on what to do? Should I try the command from the other post you suggested?
User avatar
lgute
Posts: 420
Joined: Mon Apr 06, 2020 2:49 pm

Re: NagiosXI logrotate not working

Post by lgute »

Hi @elpakko,

Please run the following to correct the log rotation issue. It does appear to be the same issue as the post I linked to.

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
One more question. Is this a new install or an upgrade? If upgrade, what was the last version you upgraded from?
Please let us know if you have any other questions or concerns.

-Laura
elpakko
Posts: 14
Joined: Fri Mar 22, 2019 1:07 am

Re: NagiosXI logrotate not working

Post by elpakko »

Thanks, I ran the command and now the logrotate seems to be working again. The previous version was 5.11.2 but according to lograte info, the last succesfull rotation was 17.5.2023. So looking at my upgrade history, it seems that it was broken in the upgrade from 5.9.3 to 5.10.0
User avatar
lgute
Posts: 420
Joined: Mon Apr 06, 2020 2:49 pm

Re: NagiosXI logrotate not working

Post by lgute »

@elpakko,

Thank you for the update. I am glad that resolved your issue.
Please let us know if you have any other questions or concerns.

-Laura
Post Reply