log size handling

Volodymyr Kostyrko c.kworr at gmail.com
Thu Jul 17 12:51:38 UTC 2008


Mario Lobo wrote:
> On Thursday 17 July 2008, Zbigniew Szalbot wrote:

> What would be the proper way to set the rotation of apache logs in 
> newsyslog.conf when there are separate log files for each virtual host?

/var/log/httpd/*.log www:wheel 644 7 102400 * JG /var/run/httpd.pid 30

> Do I have to rotate them myself via a script in crontab?

If you want it.

ls /var/log/httpd/*.bz2 | sed 's|\.\([0-9]*\)\.|,\1,|' | awk 
'BEGIN{FS=","}{print"mv "$1"."$2"."$3" "$1"."$2+1"."$3}' | sh
ls /var/log/httpd/*.log | xargs -n1 -Ifoo mv foo foo.0
kill -30 `cat /var/run/httpd.pid`
sleep 1
bzip2 -9 /var/log/httpd/*.0
find /var/log/httpd/ -type -f -mtime +7 -delete

-- 
Sphinx of black quartz judge my vow.



More information about the freebsd-questions mailing list