On my webserver I have this file: /etc/logrotate.d/apache2

I know it is logrotating /var/log/apache2/.log, but if I want to add things that are in /usr/home/www/site1/logs/.log do I just duplicate everything below and stick that line in there? Each time I add a new site do I need to manually add lines to this file?

Or what is the most professional way to do this?

/var/log/apache2/*.log {
    rotate 52
    create 640 root adm
        if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
            /etc/init.d/apache2 reload > /dev/null

1 Answer 1


How about:

/var/log/apache2/*.log /usr/home/www/*/logs/*.log {

In other words, just list all the paths you need, separated by spaces. Logrotate will then check all the paths. By the way you can also test your config as noted here with the debug option -d:

logrotate -d /path/to/config

In the output it will list all the files it checks:

considering log /var/log/nginx/access.log
  log does not need rotating
  • I like the wildcards - that should work. What about the other options - I guess I'm also asking: What are the standard {professional grade} options for apache access and error logs?
    – cwd
    Jun 24, 2011 at 0:28
  • The question of what is "most professional" is hard to answer, because (a) it's ultimately an opinion question and (b) it really depends on your environment. Your solutions are going to be very different if you have hundreds of servers, or if you your server logs are covered by some sort of regulatory compliance (or company policy).
    – larsks
    Aug 1, 2013 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.