Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
/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.

share|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

2 Answers 2

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

}

share|improve this answer
1  
Why does this work? –  Frederik Feb 13 '12 at 15:05

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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