Cronolog在
Windows + Apache下的安装
原文:
http://server.it168.com/server/2007-12-27/200712270901079.shtml
Apache 的日志默认是直接写入一个独立的 log
文件。如果网站流量大,日志
文件很快就会变得很庞大;而 AWStats 等日志分析
软件,要求日志
文件以天的格式保存。cronolog 正好可以解决这个问题:它可以对 Apache 的日志按需要进行截断处理(cronolog 也是Apache推荐使用的日志
工具之一),是使用 AWStats 进行日志分析的基础。这是cronolog 官方网站
http://www.cronolog.org/ 上的介绍:
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.
如何在
Linux+Apache 环境下安装 cronolog 的文章很多,此文简单地说明一下 cronolog 在 Windows + Apache 下的安装:
1. 首先到 cronolog 的网站
http://www.cronolog.org/下载。注意应该
下载 Win 32 version (ZIP file) 的版本。目前最新的 win 32 version 是 1.6.1。
2. 将 zip 文件下载之后,将 cronolog.exe 解压并复制到 Apache 的 bin 目录
3. 在 apache 的配置文件 httpd.conf 中, 修改以下代码:
4. CustomLog "|bin/cronolog.exe logs/access_%Y%m%d.log" combined
ErrorLog "|bin/cronolog.exe logs/error_%Y%m%d.log"
也可以在虚拟
主机配置中使用,例如:
<VirtualHost *:80>
ServerName
www.xiaohui.com
CustomLog "|bin/cronolog.exe logs/xiaohui.com/access_%Y%m%d.log" combined
ErrorLog "|bin/cronolog.exe logs/xiaohui.com/error_%Y%m%d.log"
</VirtualHost>
5. 重新启动 Apache.
6. 其他
设置说明,请见下载包中的 README 文件。
注:本文经作者xiaohui.com授权IT168
服务器频道刊登,原文链接:
www.xiaohui.com