So I have a number of apache logs I like to handle with logrotate on a developer box. Some of them are for user sandboxes, others are for staging versions and such.

The logrotate config looks like:

/home/developerx/logs/*.log {
    rotate 100
    olddir archive
        /sbin/service httpd reload > /dev/null 2>/dev/null || true

I would like to customize some of the settings for beta versus a sandbox, like rotate 10 instead of 100 for a sandbox. I could create a new context for this, but if I do the postrotate "reload" for multiple contexts I worry that the process will be reloaded multiple times.

As a secondary question, is there any way to determine the order in which logrotate will process these entries? Alphabetical by filename, and first-to-last within a file?

1 Answer 1


Yes, if you write a separate entry, and it will have a reload command, the http server will be reloaded twice.

I believe logrotate applies the rules just as you described. It includes files in logrotate.d directory and just works through them, first to last entry. I have a logrotate monitoring based on this fact: the last rule in one particularly tricky set of files has a postrotate script which echoes date +%j to a status file.

You can check all of the above with logrotate -d -f /etc/logrotate.conf where -d stands for 'debug'.

Apache, though, can use rotatelogs as a custom logger, and the CustomLog directive can be different for each of sites you have, so you can treat differenrt logs the different way and eliminate that reload problem.


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.