How do I tell logrotate what files to rotate with cron?

Posted by cwd on Server Fault See other posts from Server Fault or by cwd
Published on 2011-06-23T23:10:42Z Indexed on 2011/06/24 0:24 UTC
Read the original article Hit count: 529

Filed under:
|
|

On my webserver I have this file: /etc/logrotate.d/apache2

I know it is logrotating /var/log/apache2/.log, but if I want to add things that are in /usr/home/www/site1/logs/.log do I just duplicate everything below and stick that line in there? Each time I add a new site do I need to manually add lines to this file?

Or what is the most professional way to do this?

/var/log/apache2/*.log {
    weekly
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    create 640 root adm
    sharedscripts
    postrotate
        if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
            /etc/init.d/apache2 reload > /dev/null
        fi
    endscript
}

© Server Fault or respective owner

Related posts about apache

Related posts about apache2