Logs not rotating

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Logs not rotating

Post by scottwilkerson »

[email protected] wrote:and found the reason the cron file was completely ignoted in the error output:
Ignoring nagiosxi because the file owner is wrong (should be root).
This also is placed by the following command in the fullinstall and upgrade

Code: Select all

cp ./nagiosxi/logrotate.nagiosxi /etc/logrotate.d/nagiosxi
and both should be run as root which should set the user as root
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 68
Joined: Wed Dec 27, 2017 2:20 pm
Location: Nieuwegein, The Netherlands
Contact:

Re: Logs not rotating

Post by [email protected] »

Ok Scott.

What about the other issues reported by /usr/sbin/logrotate -d -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf'?
Are the devs fixing this by adding "su" directives or change write permissions for 'others' on parent folders?
Although "su nagios nagios" was introduced in XI version 5.6.6 for the first cron paragraph there's still some work to do on other files and folders:
error: skipping "/usr/local/nagiosxi/var/xidebug.log" because parent directory has insecure permissions
error: skipping "/usr/local/nagiosxi/var/xidebug.log.backtrace" because parent directory has insecure permissions
error: skipping "/var/log/snmptt/snmptt.log" because parent directory has insecure permissions
error: skipping "/var/log/snmptt/snmpttsystem.log" because parent directory has insecure permissions
error: skipping "/var/log/snmptt/snmpttunknown.log" because parent directory has insecure permissions
error: skipping "/var/log/snmptt/snmptthandler.debug" because parent directory has insecure permissions
error: skipping "/var/log/snmptt/snmptt.debug" because parent directory has insecure permissions
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Logs not rotating

Post by scottwilkerson »

Sorry, yes this is planned to be adjusted in 5.6.7
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
PeterDK
Posts: 25
Joined: Tue Jun 05, 2018 9:19 am

Re: Logs not rotating

Post by PeterDK »

Hi,

I'm facing the same issue on version 5.6.2, today I upgraded to 5.6.7 and the permission errors are gone, but the logs are not being rotated.

I ran the following command like mentioned above: sudo /usr/sbin/logrotate -d -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf

This is the part of the output about sysstat.log:

Code: Select all

renaming /usr/local/nagiosxi/var/sysstat.log to /usr/local/nagiosxi/var/sysstat.log-20190930
creating new /usr/local/nagiosxi/var/sysstat.log mode = 0644 uid = 1236 gid = 1236
compressing log with: /bin/gzip
removing old log /usr/local/nagiosxi/var/sysstat.log-20190521.gz
switching euid to 0 and egid to 0
The file is not renamed, no new file is being created and the old compressed file (20190521) still exists

Is there something else we need to do to solve this?

Kind regards,
Peter
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Logs not rotating

Post by scottwilkerson »

Can you show the oputput of the following:

Code: Select all

ls -l /usr/local/nagiosxi/var/sysstat*
ls -ld /usr/local/nagiosxi/var
Thanks
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
PeterDK
Posts: 25
Joined: Tue Jun 05, 2018 9:19 am

Re: Logs not rotating

Post by PeterDK »

Hi Scott,

here are the outputs:
ls -l /usr/local/nagiosxi/var/sysstat*
-rw-r--r-- 1 nagios nagios 4563685260 Sep 30 13:54 /usr/local/nagiosxi/var/sysstat.log
-rw-r--r-- 1 nagios nagios 1056079 May 21 03:29 /usr/local/nagiosxi/var/sysstat.log-20190521.gz

ls -ld /usr/local/nagiosxi/var
drwxrwxr-x. 7 nagios nagios 4096 Sep 30 13:54 /usr/local/nagiosxi/var

Kind regards,
Peter
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Logs not rotating

Post by scottwilkerson »

Looking again, you passed the -d flag

Code: Select all

-d, --debug
              Turns on debug mode and implies -v.  In debug mode, no changes will be made to the logs or to the logrotate state file.
In order for it to actually rotate you would need to not pass the -d flag or let it happen naturally on the next normal rotation day.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
PeterDK
Posts: 25
Joined: Tue Jun 05, 2018 9:19 am

Re: Logs not rotating

Post by PeterDK »

That I didn't notice, indeed.

Works without the -d flag.

Thank you very much!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Logs not rotating

Post by scottwilkerson »

I believe this is fully resolved as of 5.6.7
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked