Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Logrotate can work on individual files or wildcarded files (*.log, for example) in a specified directory, but does it inherently have the ability to traverse a directory tree of arbitrary depth and process files it finds?


share|improve this question
up vote 2 down vote accepted

No, it doesn't. You can wildcard the directories though so if your tree has a small-ish known depth you could do something like:

   /a/* /a/*/* /a/*/*/*  {
       rotate 5

If you only have logs at the leaf only /a/*/*/* is needed.

"Please use wildcards with caution. If you specify *, logrotate will rotate all files, including previously rotated ones. A way around this is to use the olddir directive or a more exact wildcard (such as *.log)" -- logrotate man page

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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