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.

orokusaki
  • 2,763
  • 4
  • 32
  • 43

2 Answers2

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.

ztron
  • 317
  • 1
  • 8
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

}

becomingwisest
  • 3,328
  • 20
  • 18