1

I have the following logrotate configuration, and a 2 GB /var/log/messages:

/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/network {
    hourly
    rotate 5
    size 1M
    compress
    postrotate
        service syslog-ng reload
    endscript
}

I manually run logrotate -d -v /etc/logrotate.conf, the output says:

rotating pattern: /var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/network  1048576 bytes (5 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/messages
   log needs rotating

And then nothing is done on /var/log/messages, the file is still 2GB large.

So was there a mistake in the configuration?

2

A few hints in order of importance:

-) logrotate configuration file seems ok but is there somebody calling logrotate? This is usually done by cron or anacron. Check this out since logrotate needs somebody to call it indeed (usually cron/anacron) otherwise configuring it is useless. Check in your cron/anacron configurations and check that the daemon is active.

-) hourly doesn't look to be a valid configuration option at least in my version, check this out to be sure

-) when you run it manually with the "-d" no changes will be made to files so for that run it's correct that nothing happened. So to make sure at least the configuration is 100% fine try it without -d. And eventually with -f to force the rotation so you can check for eventual permission or such troubles.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.