Oct 302009
 

Adding a logrotate script to clean up apache will normally take care of this problem. The default logrotate script is either /etc/logrotate.d/apache or /etc/logrotate.d/httpd.

vim /etc/logrotate.d/httpd or apache

insert the code below:

/usr/local/apache/logs/*log /usr/local/apache/domlogs/*.com /usr/local/apache/domlogs/*.net /usr/local/apache/domlogs/*.org /usr/local/apache/domlogs/*.edu /usr/local/apache/domlogs/*.it /usr/local/apache/domlogs/*.dk /usr/local/apache/domlogs/*.de /usr/local/apache/domlogs/*.nz /usr/local/apache/domlogs/*.si /usr/local/apache/domlogs/*.in /usr/local/apache/domlogs/*.ie /usr/local/apache/domlogs/*.fr /usr/local/apache/domlogs/*.es /usr/local/apache/domlogs/*.br /usr/local/apache/domlogs/*.ar /usr/local/apache/domlogs/*.jp /usr/local/apache/domlogs/*.uk /usr/local/apache/domlogs/*.ru /usr/local/apache/domlogs/*.at /usr/local/apache/domlogs/*.nl /usr/local/apache/domlogs/*.us /usr/local/apache/domlogs/*.gov /usr/local/apache/domlogs/*.au /usr/local/apache/domlogs/*.tr /usr/local/apache/domlogs/*.tt /usr/local/apache/domlogs/*.no /usr/local/apache/domlogs/*.ro /usr/local/apache/domlogs/*.cn /usr/local/apache/domlogs/*.ca /usr/local/apache/domlogs/*.cz /usr/local/apache/domlogs/*.sp /usr/local/apache/domlogs/*.pl /usr/local/apache/domlogs/*.sa /usr/local/apache/domlogs/*.gr /usr/local/apache/domlogs/*.il /usr/local/apache/domlogs/*.ph /usr/local/apache/domlogs/*.info /usr/local/apache/domlogs/*.pr /usr/local/apache/domlogs/*.sy /usr/local/apache/domlogs/*.ua {
compress
weekly
notifempty
missingok
rotate 3
sharedscripts
postrotate
/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

This should catch most of the domloas on the system and rotate them out with the following command;

logrotate -fv /etc/logrotate.d/httpd or apache

 Posted by at 10:21 am

 Leave a Reply