AWStats Log for Apache分析工具使用笔记(一)
AWStats是一个基于Perl的WEB日志分析工具。文章中使用的Apache版本为2.2
在Windows下安装
AWStats是perl语言书写的程序,所以必选先安装ActivePerl(for win32)程序。下载地址:http://activestate.com/store/productdetail.aspx?prdGuid=81fbce82-6bd5-49bc-a915-08d58c2648ca
1、安装ActivePerl
运行安装,基本上一路回车就OK了。
2、安装AWStats6.6
安装之前必须已经安装好ActivePerl,基本上一路回车就OK了。只是在最后一步的时候,会提示输入一些信息,第一个记得添none,log文件要输入绝对路径,你的站点输入你的域名,其他按提示输入就可以了。
如果安装正常,会在安装目录下的wwwroot/cgi-bin目录下生成一个新文件:awstats.【yoursite】.conf,如果没有的这个文件,那么就需要重新配置一下,步骤如下:
(1)、切换到命令行,然后进入AWStats的安装目录下的tools目录,输入perl awstats_configure.pl ,按回车,根据提示输入信息。
如果安装正常,会在Apache的conf目录下的httpd.conf文件的最后追加如下信息:
#
# Directives to add to your Apache conf file to allow use of AWStats as a CGI.
# Note that path "/usr/local/awstats/" must reflect your AWStats Installation path.
#
Alias /awstatsclasses "【/usr/local/awstats】/wwwroot/classes/"
Alias /awstatscss "【/usr/local/awstats】/wwwroot/css/"
Alias /awstatsicons "【/usr/local/awstats】/wwwroot/icon/"
ScriptAlias /awstats/ "【/usr/local/awstats】/wwwroot/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "【/usr/local/awstats】/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
awstats_configure.pl 将产生一个叫awstats.【yoursite】.conf的文件,复制到"【/usr/local/awstats】/wwwroot/cgi-bin/"目录下。
(2)、打开awstats.【yoursite】.conf 文件,
将LogFile设置为服务器的Log文件(完整路径),
将LogType设置为“W”,
将LogFormat设置为“1”或者“4”,
将SiteDomain设置为【yoursite】,
将HostAliases设置为服务器的别名,例如:127.0.0.1 ,localhost等
(3)、验证安装是否正确
切换到命令行,输入:perl awstats.pl -config=【yoursite】 -update
如果出现下面的信息,就说明安装成功了:
Update for config "/etc/awstats/awstats.mysite.conf"
With data in log file "/pathtoyourlog/yourlog.log"...
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: 225730
Found 122 dropped records,
Found 87 corrupted records,
Found 0 old records,
Found 225521 new qualified records.
至此,AWStats6.6安装完成。
3、运行AWStats6.6,统计结果
方式一:
切换到命令行,输入perl awstats.pl -config=fireflys -output -staticlinks > awstats.fireflys.html ,生成awstats.fireflys.html 文件即是统计结果。
方式二:
通过网站统计结果,在第二步的时候,我们在Apache服务器的配置文件httpd.conf中,追加了虚拟服务器,这里我们就用到了。
在IE地址栏中输入:http://【www.myserver.mydomain】/awstats/awstats.pl?config=【mysite】,其中【www.myserver.mydomain】应该为你网站的URL或者是HostAliases中设置的值(例如:localhost或者是127.0.0.1),将会显示统计结果。
如果出现Internal Error ,
请确认Apache服务器的cgi是否开启,打开httpd.conf文件,找到ScriptInterpreterSource registry这一行,把这行前面的#号去掉,然后重启Apache服务器即可解决。
页:
[1]