0

For the first time today, I am trying to write a configuration file for logrotate. When I restart the logrotate service, I get the following error: logrotate.service: Failed with result 'exit-code'.

If I delete my file and restart logrotate.service, everything is OK

Here is my logrotate.conf configuration file

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
#dateext

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# system-specific logs may be also be configured here.

Here is my custom configuration file

/var/www/webd/logs/clean.log
{
        rotate 12
        monthly
        missingok
        notifempty
        compress
}

What is wrong with this file?

Thanks,

Thierry

theirman
  • 1
  • 2
  • What is your operating system and version? Is logrotate actually configured to run as a service on that system? What does `sudo systemctl status logrotate` (or equivalent on your OS) report? Please edit your question to add that information. – Tilman Schmidt Feb 23 '22 at 13:53

1 Answers1

0

Thanks to your answer @Tilman Schmidt, I realized that my problem came from a problem of access right to the log file

févr. 24 08:34:30 logrotate[23728]: error: skipping "/var/www/webd/logs/clean.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.

by adding the clause su webd webd in my configuration file and by restarting the logrotate service, everything is back to normal

/var/www/webd/logs/clean.log
{
        rotate 12
        monthly
        missingok
        notifempty
        compress
        su webd webd
}

Thanks for your help :)

theirman

theirman
  • 1
  • 2