Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

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.