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
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
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 theolddirdirective or a more exact wildcard (such as*.log)" -- logrotate man page