2

I currently have a Django app running on Ubuntu under Apache. The Apache logs are generated at:

/home/user/django/myproject/log/apache_access.log
/home/user/django/myproject/log/apache_error.log

The above logs are currently growing very rapidly, so I create a configuration file for logrotate and place it under /etc/logrotate.d. The configuration is called: my_app, it's path is /etc/logrotate.d/my_app. The content of my_app is:

/home/user/django/myproject/log/*.log{
    daily
        missingok
        rotate 7
        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
}

Will the above configuration logrotate the apache log?

1 Answer 1

2

Yes, that is all you need to do.

When logrotate runs the main configuration file includes all the configuration fragements in the logrotate.d folder.

See:

/etc/logrotate.conf
...
# packages drop log rotation information into this directory
include /etc/logrotate.d
1
  • Of course, you should make sure the include line is NOT commented out in your install
    – uSlackr
    Commented Sep 15, 2011 at 21:19

You must log in to answer this question.

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