1. 解压源码包
[root@MFS-chunkserver-2 ]#cd /srv/
[root@MFS-chunkserver-2 ]#tar zvxf awstats-6.6.tar.gz
[root@MFS-chunkserver-2 ]#tar zvxf cronolog-1.6.2.tar.gz
2. 安装awstats
[root@MFS-chunkserver-2 ]#mv awstats-6.6 /usr/local/
[root@MFS-chunkserver-2 ]#cd /usr/local/
[root@MFS-chunkserver-2 ]#mv awstats-6.6/ awstats
[root@MFS-chunkserver-2 ]#cd awstats/
[root@MFS-chunkserver-2 ]#cd tools/
[root@MFS-chunkserver-2 ]#perl awstats_configure.pl
3. 安装cronlog
[root@MFS-chunkserver-2 ]#cd /srv/
[root@MFS-chunkserver-2 ]#cd cronolog-1.6.2
[root@MFS-chunkserver-2 ]#./configure
[root@MFS-chunkserver-2 ]#make
[root@MFS-chunkserver-2 ]#make install
4. 编辑tomcat 的主配置文件
[root@MFS-chunkserver-2 ]# cd /usr/local/tomcat/conf/
[root@MFS-chunkserver-2 ]# vi server.xml (更改内容如下)
原内容为:
<!--
&lt;Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log."
suffix=".txt"
pattern="common" resolveHosts="false"/>
--&gt;
要更改为:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="access." suffix=".log"
pattern="combined" fileDateFormat="yyyy-MM-dd"
resolveHosts="false"/>
5. 叫tomcat支持cgi
[root@MFS-chunkserver-2 ]# cd /usr/local/tomcat/server/lib/
[root@MFS-chunkserver-2 ]# mv servlets-cgi.renametojar servlets-cgi.jar
6. 编辑awstats 配置文件
[root@MFS-chunkserver-2 ]#vi
/etc/awstats/awstats.ispace.qubaoquan.com.conf(更改如下选项)
LogFile="/usr/local/tomcat/logs/access.%YYYY-0-%MM-0-%DD-0.log"
DirData="/usr/local/awstats/data"
7. 创建数据目录
[root@MFS-chunkserver-2 ]#mkdir -p /usr/local/awstats/data/
[root@MFS-chunkserver-2 ]#chown –R 777 /usr/local/awstats/data/
8. 创建自动化任务
[root@MFS-chunkserver-2 ]#crontab -e
* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update
-config=ispace.qubaoquan.com
9. 因为我的环境是通过apache代理的tomcat,所以还要配置apache的主配置文

[root@MFS-chunkserver-2 ]# vi /etc/httpd/conf/httpd.conf(添加到文件末尾)
<VirtualHost *:80>
ServerName www.qubaoquan.com
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/"
<Directory "/usr/local/awstats/wwwroot">
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName ispace.qubaoquan.com
ProxyPass / http://192.168.10.251:8080/ispace1/
ProxyPassReverse / http://192.168.10.251:8080/ispace1/
</VirtualHost>
10. 重启apache和tomcat
11. 现在就可以通过浏览器访问日志分析页面.
http://192.168.10.195/awstats/awstats.pl?config=ispace.qubaoquan.com
注释:现在生成的日志文件的格式名格式为:access.2010-03-24.log