AWStats在IIS中的配置步骤
AWStats是sourceforge.net上很有名的Web/Mail/FTP服务器日志文件分析工具。
网上的安装方法很多,都有写掉的或错误的。害的我走了不少弯路。下面的方法是我改进的
安装配置步骤(适用于分析IIS日志文件)
1、下载AWStats, 下载地址:http://sourceforge.net/projects/awstats/
2、由于AWStats是Pertl写的,所以要下载Perl 解释器, 下载地址: http://activestate.com/Products/ActivePerl/
3、安装Perl 解释器ActivePerl
4、安装AWStats(这里假设安装在d:\Program Files), 出现命令提示时,第一次输入none, 第二次输入你的主机的域名
5、配置IIS日志
5.1 活动日志格式选用默认的“W3C扩充扩展日志文件格式”
5.2 点击“属性”,再选择“扩展属性”,选中下列项目:
date
time
c-ip
cs-username
cs-method
cs-uri-stem
cs-uri-query
sc-status
sc-bytes
cs-version
cs(User-Agent)
cs(Referer)
其他都不要选中。
6、建立虚拟目录cgi-bin,映射到d:\Program Files\AWStats\wwwroot\cgi-bin。
建立虚拟目录ico, 映射到d:\Program Files\AWStats\wwwroot\icon
[注意] 虚拟目录访问权限有:读取(R) 、运行脚本(如ASP)(S) 、执行(如ISAPI应用程序或CGI)(E) 、写入(W) 、浏览(O)。
7、修改d:\Program Files\AWStats\wwwroot\cgi-bin中的相应的配置文件:awstats.myvirtualhostname.conf(myvirtualhostname为你第4步中输入的域名, 比如www.cnblogs.com)。修改下列项目:
LogFile="C:\WINDOWS\System32\LogFiles\W3SVC1\ex%YY-0%MM-0%DD-24.log"
LogFormat="date time cs-method cs-uri-stem cs-uri-query cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes"
AllowToUpdateStatsFromBr
LoadPlugin="timezone +8"
8、停止IIS, 删除C:\WINDOWS\System32\LogFiles\W3SVC1下的所有日志文件
9、使配置生效:
在dos环境下进入perl的目录
C:\Documents and Settings\Administrator> cd C:/Perl/bin;
C:\Perl\bin> Perl "d:\Program Files\AWStats\wwwroot\cgi-bin\awstats.pl" --update -config= myvirtualhostname
如果有类似的提示表示生效:
Update for config "d:\Program Files\AWStats\wwwroot\cgi-bin/awstats.b-1.conf"
With data in log file "C:\WINDOWS\System32\LogFiles\W3SVC1\ex060724.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 15)
Jumped lines in file: 15
Found 15 already parsed records.
Parsed lines in file: 25
Found 2 dropped records,
Found 6 corrupted records,
Found 0 old records,
Found 17 new qualified records.
10、配置完成,
通过Web访问日志http://www.myserver.mydomain/cgi-bin/awstats.pl?config=myvirtualhostname,点击“立即更新”。
本机访问:http://127.0.0.1/cgi-bin/awstats.pl?config=myvirtualhostname
11、IP地址插件
如果需要对访问用户的IP地址进行分析,需要使用IP地址插件,安装该插件以后,可以按照国家进行统计,它的安装稍微复杂一些。
我们使用GeoIPfree插件,首先在配置文件中打开该插件
LoadPlugin="geoipfree"
下载GeoIPfree软件,该软件为免费软件,
网址为:http://search.cpan.org/~gmpassos/Geo-IPfree-0.2/
文件为:Geo-IPfree-0.2.tar.gz
安装配置
首先使用winzip等解压缩该软件,再进行软件的编译链接
在命令行执行:perl makefile.pl
再将lib目录下的geo目录复制到Perl的库文件目录中或者AWStats的插件目录中。其中Perl的库目录为才c:\Perl\lib ,AWStats插件目录为C:\Program Files \AWStats\wwwroot\cgi-bin\plugins 。
最后运行“9、使配置生效:”