script para girar o weblog do apache

2

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

    
por drAlberT 25.09.2009 / 17:47

2 respostas

5

instale e configure o logrotate

por 25.09.2009 / 17:48
4

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 
    
por 25.09.2009 / 18:08