Apache, logerror and logrotate: what is the best method?

Posted by OlivierDofus on Server Fault See other posts from Server Fault or by OlivierDofus
Published on 2010-03-13T13:48:42Z Indexed on 2010/03/13 13:55 UTC
Read the original article Hit count: 234

Filed under:
|

Hi!

Here's a vhost example of my sites:

<VirtualHost *:80>
    DocumentRoot /datas/web/woog
    ServerName woog.com
    ServerAlias www.woog.com
    ErrorLog "|/httpd-2.2.8/bin/rotatelogs /logs/woog/error_log 86400"
    CustomLog "|/httpd-2.2.8/bin/rotatelogs /logs/woog/access_log 86400" combined
    DirectoryIndex index.php index.htm

    <Location />
        Allow from All
    </Location>

    <Directory /*>
        Options FollowSymLinks
        AllowOverride Limit AuthConfig
    </Directory>

</VirtualHost>

I've got 12 sites running now. This gives something like:

[Shake]:/sources/software/mod_log_rotate# ps x | grep rotate
/httpd-2.2.8/bin/rotatelogs /logs/[hidden siteweb]/error_log 86400
/httpd-2.2.8/bin/rotatelogs /logs/[hidden siteweb]/error_log 86400
[snap (as many error_log as virtual hosts)]
/httpd-2.2.8/bin/rotatelogs /logs/[hidden siteweb]/access_log 86400
/httpd-2.2.8/bin/rotatelogs /logs/[hidden siteweb]/access_log 86400
[snap (as many access_log as virtual hosts)]
grep rotate
[Shake]:/sources/software/mod_log_rotate# 

!!!

I've been looking everywhere but I've only found mod_log_rotate. The "little" problem is that the author (very good C developper) explains: "Unfortunately Apache error logs are handled in such a way that we can't work the same log rotation magic on them. Like transfer logs they support piped logging though so you can still use rotatelogs for them. "

So my question is: what would be the best way to handle multiple logs? If I just do a very classical log and I use the system's "logrotate" program couldn't this be a good deal? How would/do you deal with that?

Thank you!

© Server Fault or respective owner

Related posts about apache2

Related posts about logrotate