0
/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.

3
  • It would help if you said exactly how it's not working. Feb 4, 2011 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, 2011 at 19:29
  • You can try to manually run logrotate to see if it is really working properly or not.
    – Khaled
    Feb 4, 2011 at 19:51

2 Answers 2

1

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

}

1
  • 1
    Why does this work?
    – Frederik
    Feb 13, 2012 at 15:05
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .