permission denied logrotate rule incorrect

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
BradZynda
Posts: 31
Joined: Thu Jul 06, 2017 12:43 pm

permission denied logrotate rule incorrect

Post by BradZynda »

Hello,

Besides the selinux rules that needed to be in place..

chmod 660 /usr/local/nagiosxi/var/*.log
chown apache:nagios /usr/local/nagiosxi/var/*.log

vi /etc/logrotate.d/nagiosxi

and make this:

/usr/local/nagiosxi/var/*log {
missingok
notifempty
size 5M
rotate 1
compress
}

look like this:

/usr/local/nagiosxi/var/*log {
missingok
notifempty
size 5M
create 0660 apache nagios
rotate 1
compress
}


Thanks,
Brad
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: permission denied logrotate rule incorrect

Post by tmcdonald »

I'm a bit confused here. Were you having issues with a log file and looking for a fix, or is this a proposed solution to one? What XI version is this for?
Former Nagios employee
BradZynda
Posts: 31
Joined: Thu Jul 06, 2017 12:43 pm

Re: permission denied logrotate rule incorrect

Post by BradZynda »

A little bit of both I guess, seeing this from:

/etc/cron.daily/logrotate:

error: failed to rename /usr/local/nagiosxi/var/cleaner.log to /usr/local/nagiosxi/var/cleaner.log-20170718: Permission denied
error: failed to rename /usr/local/nagiosxi/var/dbmaint.log to /usr/local/nagiosxi/var/dbmaint.log-20170718: Permission denied
error: failed to rename /usr/local/nagiosxi/var/event_handler.log to /usr/local/nagiosxi/var/event_handler.log-20170718: Permission denied
error: failed to rename /usr/local/nagiosxi/var/eventman.log to /usr/local/nagiosxi/var/eventman.log-20170718: Permission denied
error: failed to rename /usr/local/nagiosxi/var/perfdataproc.log to /usr/local/nagiosxi/var/perfdataproc.log-20170718: Permission denied
error: failed to rename /usr/local/nagiosxi/var/sysstat.log to /usr/local/nagiosxi/var/sysstat.log-20170718: Permission denied

nagiosxi 5.4.5

Thanks,
Brad
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: permission denied logrotate rule incorrect

Post by tgriep »

Another thing to check is that the folder permissions are set correctly for the nagios user account as well as the group.

Code: Select all

/usr/local/nagiosxi/var/

Code: Select all

drwxr-xr-x  5 nagios nagios 4096 Jul 18 16:38 var
That could be another cause for the error.
Be sure to check out our Knowledgebase for helpful articles and solutions!
BradZynda
Posts: 31
Joined: Thu Jul 06, 2017 12:43 pm

Re: permission denied logrotate rule incorrect

Post by BradZynda »

ls -la /usr/local/nagiosxi/var/
total 3720
drwxr-xr-x. 5 nagios nagios 4096 Jul 19 18:40 .
drwxr-xr-x. 10 nagios nagios 102 Jul 19 13:39 ..
-rw-r--r--. 1 nagios nagios 173186 Jul 19 18:40 cleaner.log
-rw-r--r--. 1 nagios nagios 272420 Jul 19 18:40 cmdsubsys.log
drwsrwsr-x. 2 apache nagios 6 Jul 19 13:39 components
-rw-r--r--. 1 nagios nagios 6 Jul 19 18:40 corelog.data
-rw-r--r--. 1 nagios nagios 0 Jul 19 18:40 corelog.diff
-rw-r--r--. 1 nagios nagios 179906 Jul 19 18:40 dbmaint.log
-rw-r--r-- 1 nagios users 0 Jul 19 18:40 event_handler.lock
-rw-r--r--. 1 nagios nagios 63148 Jul 19 18:40 event_handler.log
-rw-r--r--. 1 nagios nagios 31637 Jul 19 18:40 eventman.log
-rw-r--r--. 1 nagios nagios 36974 Jul 19 18:40 feedproc.log
-rw-r--r--. 1 nagios nagios 1069 Jul 19 16:13 load_url.log
-rw-r--r--. 1 nagios nagios 182886 Jul 19 16:42 nom.log
-rw-r--r--. 1 nagios nagios 159464 Jul 19 18:40 perfdataproc.log
-rw-r--r--. 1 nagios users 1365 Jul 19 18:01 recurringdowntime.log
-rw-r--r--. 1 nagios nagios 1908 Jul 19 14:28 reportengine.log
drwxr-xr-x. 2 nagios nagios 50 Jul 19 18:17 subsys
-rw-r--r--. 1 nagios nagios 2259660 Jul 19 18:40 sysstat.log
drwxr-xr-x. 2 nagios nagios 6 Jul 19 13:39 upgrades
-rw-r--r--. 1 nagios nagios 7 Jul 19 13:39 xi-itype
-rw-r--r--. 1 nagios nagios 12248 Jul 19 13:43 xi-sys.cfg
-rw-r--r--. 1 nagios nagios 37 Jul 19 13:39 xi-uuid
-rw-r--r--. 1 nagios nagios 196 Jul 19 13:43 xiversion
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: permission denied logrotate rule incorrect

Post by tgriep »

The permissions for the folder / flies look correct.
The files from the previous post are not in that folder anymore so that could of been a onetime error.
If you run the following, do you still get any errors for the files in that folder?

Code: Select all

/usr/sbin/logrotate /etc/logrotate.conf
Be sure to check out our Knowledgebase for helpful articles and solutions!
BradZynda
Posts: 31
Joined: Thu Jul 06, 2017 12:43 pm

Re: permission denied logrotate rule incorrect

Post by BradZynda »

Works fine with the yum install for Centos7, the previous errors where directly related to the tar fullinstall, seemed to have a bunch of issues with installing that way.

Thanks,
Brad
bolson

Re: permission denied logrotate rule incorrect

Post by bolson »

May we go ahead and close this topic?
BradZynda
Posts: 31
Joined: Thu Jul 06, 2017 12:43 pm

Re: permission denied logrotate rule incorrect

Post by BradZynda »

Yep, please do.

Thanks,
Brad
bolson

Re: permission denied logrotate rule incorrect

Post by bolson »

Closing topic as resolved.

Thank you for using the Nagios Support Forum.
Locked