AWStats配置 (Windows + Apache )

由于需要,需要在一台windows服务器上安装日志统计工具,自然而然的就想到了awstats。以前有做过在linux下配置awstats,这次再试试windows的。

首先需要下载几个工具,当然都是运行在windows平台的。

perl5
cronolog
awstats

下载地址分别为:
perl5:
cronolog: cronolog.org/download/index.html
awstats: awstats.sourceforge.net/#DOWNLOAD

推荐阅读:

CentOS 6.3下AWStats+GeoIP实现查看网站访问归属地

Nginx 日志分析 AWStats + JAWStats 安装配置

经典日志分析工具-AWStats

AWStats日志系统配置文件和错误归纳

使用AWStats分析网站日志-强大的日志分析工具

AWStats 的详细介绍请点这里
AWStats 的下载地址请点这里

好,先安装perl5,然后从cronolog的压缩包中把cronolog.exe提取出来,
解压缩awstats压缩包,放到你想要的目录中留待备用。

假设目录结构如下:
D:/
awstats/
per5/
bin/
perl.exe
cronolog/
cronolog.exe
awstats-6.9/
wwwroot/
js/
icon/
css/
classes/
cgi-bin/
tools/
docs/
README.TXT

———-

现在先来修改apache的配置文件。
这里需要在配置文件末尾增加如下代码(让apache可以访问到awstats的目录):
Alias /awstatsclasses “D:/awstats/awstats-6.9/wwwroot/classes/”
Alias /awstatscss “D:/awstats/awstats-6.9/wwwroot/css/”
Alias /awstatsicons “D:/awstats/awstats-6.9/wwwroot/icon/”
ScriptAlias /awstats/ “D:/awstats/awstats-6.9/wwwroot/cgi-bin/”
#
# This is to permit URL access to scripts/files in AWStats directory.
#

Options None
AllowOverride None
Order allow,deny
Allow from all

再来加一行,设置记录日志格式的,假设日志记录在D:/Logs/httpd
LogFormat “%h %l %u %t /”%r/” %>s %b /”%{Referer}i/” /”%{User-Agent}i/”" combined
LogFormat “%h %l %u %t /”%r/” %>s %b” common
CustomLog “|D:/awstats/cronolog/cronolog.exe D:/Logs/httpd/access_awstats.%Y%m%d” combined

注:如果有虚拟站点,放在虚拟站点里配置比较合理

好了,apache的配置文件搞好了,重启apache,就可以让你的设置生效,接下来在log目录下就可以看到记录了,
接下来进行awstats的配置文件

———-

进入到:D:/awstats/awstats-6.9/wwwroot/cgi-bin 目录。
找到默认的awstats.model.conf文件,复制出来两份到当前目录,一份取名为:
common.conf,另一份取名为:awstats.,具体的名字根据你的域名更改吧。
common.conf不用去管,打开awstats.,把里面的内容清空,换成如下内容:

#包含通用的配置文件
Include “common.conf”
#按日期时间分割的日志文件的位置
LogFile=”D:/Logs/httpd/access_awstats.%YYYY-24%MM-24%DD-24.txt”
#记录日志文件的类型,这个如果是apache的话不用修改
LogType=W
#记录日志文件的类型,这个如果是apache,LogFormat是combined的话不用修改
LogFormat=1
#日志每条记录每列的分隔符,一般不用修改
LogSeparator=” ”
#记录日志的域名
SiteDomain=””
#主机别名
HostAliases=”127.0.0.1″
#存放分析日志结果的目录,这个目录一定要存在
DirData=”./data”
#cgi-bin目录,这个一般不用修改
DirCgi=”/cgi-bin”
#icon图标存在的目录,这个需要修改成/awstatsicons
DirIcons=”/awstatsicons”

———-

好了,进行完如上配置,可以开始测试了,先用命令行方式,进入到D:/awstats/awstats-6.9/wwwroot/cgi-bin目录,
然后执行:
D:/awstats/perl5/bin/perl.exe awstats.pl -config=www.domain.com,不出意外的话,会显示出如下信息:
Create/Update database for config “./awstats.” by AWStats ver
sion 6.9 (build 1.925)
From data in log file “D:/Logs/httpd/access_awstats.20090907.txt”…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…
Jumped lines in file: 0
Parsed lines in file: 4896
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 4896 new qualified records.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19a28822e40842d244757ccf1d7b645b.html