Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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/}`" ]; then
            /etc/init.d/apache2 reload > /dev/null
share|improve this question
up vote 3 down vote accepted

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
share|improve this answer
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 '11 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 '13 at 14:51

Your Answer


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.