apache 日志文件 处理方法

可以用apache 自己的程序 rotatelogs.exe(位于 {$apache}/bin/目录下),来限制日志文件的大小。
Usage: rotatelogs [-l] <logfile> <rotation time in seconds> [offset minutes from UTC] or <rotation size in megabytes>
在 Windows 下的设置例子如下:
# 限制错误日志文件为 1M
ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”
每天生成一个错误日志文件
#ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400”
# 限制访问日志文件为 1M
CustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 1M” common
# 每天生成一个访问日志文件
#CustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400” common
你也可以参考参考http://httpd.apache.org/docs/2.0/programs/rotatelogs.html
不过感觉这玩意儿还是和linux配合的好一些。

发表评论