Symptoms
The Plesk administrator receives alerts with the following content indicating the task /etc/cron.daily/logrotate
failed:
/etc/cron.daily/logrotate
error: skipping "/var/log/newrelic/php_agent.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/newrelic/nrsysmond.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
run-parts: /etc/cron.daily/logrotate exited with return code 1
Cause
Incorrect permissions and/or ownership on parent directory/directories.
Resolution
-
Connect to the server via SSH.
-
Set the correct permissions and ownerships on the parent directories:
# chmod 755 /var/log/ && chown root:root /var/log/
# chmod 755 /var/log/newrelic && chown root:root /var/log/newrelic
# chmod 755 /var && chown root:root /var
Note: if Ubuntu is used, make sure that su root syslog
is included into /etc/logrotate.conf
file:
# head /etc/logrotate.conf
# see “man logrotate” for details
# rotate log files weekly
weekly
# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog
# keep 4 weeks worth of backlogs
rotate 4