Rolling Apache Logfiles
This is a little snippet I whipped up long ago to roll our logs, feel free to use...
The weblog_rotate.pl is a script from Uthe Urchin folk, available at http://download.urchin.com/support/weblog_rotate.pl
#!/bin/sh /usr/bin/grep CustomLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log > logfiles /usr/bin/grep ErrorLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log >> logfiles /usr/local/bin/weblog_rotate.pl --loglist logfiles --touchlog --restart_cmd "/usr/local/etc/rc.d/apache2.sh restart" --compress --days 120
The weblog_rotate.pl is a script from Uthe Urchin folk, available at http://download.urchin.com/support/weblog_rotate.pl