Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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
share|improve this answer
    
Of course, you should make sure the include line is NOT commented out in your install – uSlackr Sep 15 '11 at 21:19

You must log in to answer this question.

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