Wednesday, July 4, 2012

logrotate: rotating logs in multiple directories

logrotate: rotating logs in multiple directories: I've got a server with almost one hundred web-sites. Each of the sites is in its own directory and runs its own logs ...

 logrotate.conf:
include /usr/local/etc/logrotate.d
Only one hour later I understood that I can just write a path with multiple meta-characters to include ALL logs in just one line:
/usr/local/www/*/logs/*.log {
    daily
    rotate 60
    compress
    notifempty
    postrotate
          [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
    endscript

}