/var/log/apache2/*.log {
        daily
        missingok
        rotate 31
        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
}

/home/admin/public_html/mywebsite.com/log/*.log {
        daily
        missingok
        rotate 31
        compress
        delaycompress
        missingok
#        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
}

This is the exact contents of apache2 file, minus the fake domain name).

When I logged back into the server after 2 days access.log in mywebsite.com/log was still multiple gigs.

Is this likely just a chmod issue? (I left the commented out lines in my question, just in case they could be the issue.

link|improve this question

It would help if you said exactly how it's not working. – Dennis Williamson Feb 4 '11 at 17:54
Dennis, the log is still as large as it was 2 days ago (multiple gigs), so I assume it's simply not working at all. – orokusaki Feb 4 '11 at 19:29
You can try to manually run logrotate to see if it is really working properly or not. – Khaled Feb 4 '11 at 19:51
feedback

2 Answers

up vote 1 down vote accepted

Try merging the two file lists.

/var/log/apache2/*.log /home/admin/public_html/mywebsite.com/log/*.log{
    daily
    missingok
    rotate 31
    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

}

link|improve this answer
1  
Why does this work? – Frederik Feb 13 at 15:05
feedback

logrotate has a really informative man page. For example you could run it in a dry run mode, logrotate would then tell you exactly what it is configured to do, without actually doing it.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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