Page 2 of 2

Re: Logs not rotating

Posted: Fri Sep 13, 2019 12:03 pm
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

Re: Logs not rotating

Posted: Tue Sep 17, 2019 3:15 pm
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

Re: Logs not rotating

Posted: Tue Sep 17, 2019 3:59 pm
by scottwilkerson
Sorry, yes this is planned to be adjusted in 5.6.7

Re: Logs not rotating

Posted: Mon Sep 30, 2019 4:45 am
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

Re: Logs not rotating

Posted: Mon Sep 30, 2019 6:31 am
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

Re: Logs not rotating

Posted: Mon Sep 30, 2019 6:56 am
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

Re: Logs not rotating

Posted: Mon Sep 30, 2019 7:23 am
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.

Re: Logs not rotating

Posted: Mon Sep 30, 2019 8:44 am
by PeterDK
That I didn't notice, indeed.

Works without the -d flag.

Thank you very much!

Re: Logs not rotating

Posted: Mon Sep 30, 2019 8:58 am
by scottwilkerson
I believe this is fully resolved as of 5.6.7