apache的一个bug

在apache1.3中,如果加载了fastcgi之后,会造成cronolog无法释放的问题,除非apachectl restart,不然cronolog对于日志的记录进程会一直存在并且会累计起来,这就造成了系统进程越来越多。 于是我们需要加载一个apache模块来解决这个问题。 fetch http://hexten.net/assets/apache13/mod_log_rotate.c 然后我们进行安装,apxs位于apache安装目录 apache/bin/下

perl apxs -i -a -c mod_log_rotate.c

这样执行完后该模块会自动增加到httpd.conf中

 并且添加

RotateLogs On (打开 log)

RotateLogsLocalTime On (用 local time 算,default 是用 UTC 時間)

RotateInterval 86400 (86400 是 default,也就是一天,这一行不加也可以)

原本用 cronolog 的地方CustomLog “|c:/bin/cronolog.exe logs/access_%Y%m%d.log” combined 改成 CustomLog logs/access_%Y%m%d.log combined 但是这个模块有个缺点,无法对于错误日志进行分割,官方网站的解释是:

Error Logs

Unfortunately Apache error logs are handled in such a way that we can’t work the same log rotation magic on them. Like transfer logs they support piped logging though so you can still use rotatelogs for them.