Skip to content

Logrotate Limitations

I having been working on a syslog architecture and one key component to the architect was leveraging log rotate for all log files. One section of my log rotate file looked like the following:

The problem was, I noticed that after the cron for logrotate ran the system started to become slow. Looking at top I noticed several things: the load average continued going up, the logrotate process continued to run with the process consuming around 50% of memory, and the syslog process never restarted.
What was causing the problem?

From the logrotate man page:

Initially, I looked into the olddir directive option. I quickly learned that the olddir directive had to exist (i.e. was not automatically created). This meant I either needed a centralized olddir directive or had to find a way to dynamically create the olddir directive within each host folder (I separated logs based on host).
Not liking the options the olddir directive left me with I looked into replacing the wildcard with something more specific. My only requirement was the ability to handle any log file. Since my syslog configuration only used standard handles, I changed the configuration to what is shown below which resolved the issue.

In summary, the log rotate limitations I ran into included:

  • Rotated logs must go to same drive as source
  • Olddir directive is not created, it must exist
  • Wildcards in the logrotate configuration file results in a process infinite loop

© 2011, Steve Flanders. All rights reserved.

Published inSystem Administration

2 Comments

    • Thanks for the tip! I will have to try this when I get the chance 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *