3

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?

thanx

user52874
  • 819
  • 2
  • 10
  • 25
  • see https://serverfault.com/questions/208006/logrotating-files-in-a-directories-and-its-subdirectories – nick fox Sep 27 '17 at 11:46

1 Answers1

3

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
       weekly
   }

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

user1011471
  • 179
  • 1
  • 8
Mark Wagner
  • 17,764
  • 2
  • 30
  • 47