2008年2月15日 星期五

Apache Log

通常Apache Log 都很肥...
這時候要利用它(access_log)來做SEO就很累了... 常常跑一半會當掉...
所以 這時候就要用 Rotate log

怎麼做呢?

使用Piped Logs
- Apache 本身有個rotatelogs 的軟體
把原先的 CustomLog logs/access_log combined 改成
CustomLog "/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" combined
- 上述指令會每24小時rotate 一次
或是
CustomLog "bin/rotatelogs /var/logs/logfile 5M" common
- 限制5 Mb的大小

另外 error_log 和其他的log 也可以如法泡製.
ErrorLog "bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"


參考:http://httpd.apache.org/docs/2.0/logs.html
http://httpd.apache.org/docs/2.0/programs/rotatelogs.html

沒有留言: