instale e configure o logrotate
Estou procurando um script que gire weblogs no apache. Eu gostaria de programar o script através do cron para que ele pudesse ser executado periodicamente e rotacionar access_log e error_log para todos os sites no servidor.
Obrigado Mark
Outra boa ferramenta é o Cronolog
cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.
Exemplo de configuração:
CustomLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/access.log"
ErrorLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/errors.log"
Produzirá e girará os registros automaticamente para:
/web/logs/2009/09/25/access.log
/web/logs/2009/09/25/errors.log
Tags bash cron logrotate linux apache-2.2