
看了车东关于 AWStats 分析 Apache 日志的文章:http://www.chedong.com/tech/awstats.html,最令人感兴趣的就是可以使用一个简单的工具 cronolog 来自动分割 Apache 日志,然后使用 AWStats 定时更新工具自动更新一定日期格式的日志文件,生成静态页面。我的系统为 Windows XP,总结步骤如下:
-
下载 cronolog 的 win32 version,我下的是唯一一个 win32 版 v1.6.2,解压后将 cronolog.exe 复制到 Apache 的 bin 目录下:C:\Program Files\Apache Group\Apache\bin\cronolog.exe。
-
编辑 Apache 的 httpd.conf,将
CustomLog d:/PATH/TO/access.log combined修改为
CustomLog "|c:/PATH/TO/conolog.exe d:/PATH/TO/%%Y/%%m/%%d/mysitename.log" combined -
设置 AWStats 中相应站点的配置文件,使用前一天的日志文件更新 AWStats 数据:
LogFile="d:\PATH\TO\%%YY-24\%%MM-24\%%DD-24\mysitename.log" -
输出。动态页面的话就是 http://logs.xdanger.com/cgi-bin/awstats.pl?config=blog.xdanger.com 静态的话还需要 AWStats 下载包里的一个额外工具 tools/awstats_buildstaticpages.pl
C:\Perl\bin\perl.exeD:\sites\xdanger.com\logs\cgi-bin\tools\awstats_buildstaticpages.pl -update -config=blog.xdanger.com -lang=cn -dir=d:\sites\xdanger.com\logs\blog.xdanger.com.html -awstatsprog=D:\sites\xdanger.com\logs\cgi-bin\awstats.pl
但是第二步重起 Apache 后该 log 文件并没建立,日志也没有记录,不知道为什么……
如果有人在 win32 下用过 conolog 的话,请一定联系我告诉我哪里出错了,万分感谢。
官方原始的 INSTALL 文档如下:
Basic Installation
Important note: You need the apache version 1.3.13-dev as minimum. The support of piped call of external programs appears in this version the first time. All prior version can not spawn the cronolog process.
You need to copy the cronolog.exe to a directory. The best place is your apache bin directory. Then you can configure the apache server configuration file to use convlog for dynamic log file splitting.
Configuration for use with NT service: TransferLog “|c:/apache/bin/convlog.exe c:/apache/logs/access%Y%m%d.log”
Configuration for use from command line: TransferLog “|c:/apache/bin/convlog.exe c:/apache/logs/access%%Y%%m%%d.log”
I do not know why the command line version requires different parameters. I filled a big report at the apache bug database.
The configuration of cronolog for windows supports ONLY the short configuration options. I did not found a getopt_long() function equivalent for windows. Please mail me if you find it.
Klaus Mueller k.mueller@intershop.de