Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17596
  • 博文数量: 9
  • 博客积分: 435
  • 博客等级: 下士
  • 技术积分: 125
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-16 08:23
文章分类
文章存档

2011年(2)

2008年(7)

我的朋友
最近访客

分类: WINDOWS

2008-08-29 15:51:04

win32 awstats 安装记 by Emerald 绿色学院 - Green Institute

一. awstats 简介
二. 下载 awstats
三. 安装 awstats
四. 下载和使用 cronolog
五. 设置 apache 的 httpd.conf 配置文件
六. 设置 AWStats
七. 更新 AWStats

/-*-------------------------------------------------------------------------------------*-/

一. awstats 简介

what is awstats

awstats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. this log analyzer works as a cgi or from command line and shows you all possible information your log contains, in few graphical web pages. it uses a partial information file to be able to process large log files, often and quickly. it can analyze log files from all major server tools like apache log files (ncsa combined/xlf/elf log format or common/clf log format), webstar, iis (w3c log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.
take a look at this comparison table for an idea on features and differences between most famous statistics tools (awstats, analog, webalizer,...).
awstats is a free software distributed under the gnu general public license. you can have a look at this license chart to know what you can/can't do.
as awstats works from the command line but also as a cgi, it can work with major web hosting provider which allow perl, cgi and log access.

you can browse awstats demo (real-time feature to update stats from web has been disabled on demos) to see a sample of most important information awstats shows you...

1. demo for web server log files

2. static demo for ftp log files

3. static demo for mail log files

/-*-------------------------------------------------------------------------------------*-/

二. 下载 awstats

----------------------------------------------------
注: 既然题目是安装记了, 嘻嘻, 那自然完全按我的方法进行.
----------------------------------------------------

我是下载 awstats-6.4.exe 自安装版本.

/-*-------------------------------------------------------------------------------------*-/

三. 安装 awstats

1. 运行 awstats-6.4.exe

2. 安装目录我设置 为: j:\awstats\

3.
#---------------------------------------------------
do you want me to build a new awstats config/proifle file
#---------------------------------------------------
选 y

4.
#---------------------------------------------------
your web site, virtual server or profile name:
#---------------------------------------------------
输入你网站的域名, 我的: gi.2288.org:88

5. 接着按两下 enter 键完成基本安装.

/-*-------------------------------------------------------------------------------------*-/

四. 下载和使用 cronolog

win 32 version (zip file)

----------------------------------------------------
注: cronolog 功能主要是用于按天数截断 apache 日志.
----------------------------------------------------

1. 解压 cronolog-1.6.1-win32 zip 包.

2. 复制 cronolog.exe 到 apache 的 bin 目录,
我的是复制到:
#---------------------------------------------------
c:\program files\apache group\apache2\bin\
#---------------------------------------------------

/-*-------------------------------------------------------------------------------------*-/

五. 设置 apache 的 httpd.conf 配置文件

1. 打开 httpd.conf 文件.

2. 先注释掉以前的日志文件
例, 我以前的日志是:

#---------------------------------------------------
customlog logs/access_log.log common env=!image-request
#---------------------------------------------------

在前面加个#字符注释掉,例:
#---------------------------------------------------
#customlog logs/access_log.log common env=!image-request
#---------------------------------------------------

3. 重新定义日志记录文件
例:
#---------------------------------------------------
customlog "|bin/cronolog.exe logs/access_%y%m%d.log" combined env=!image-request
#---------------------------------------------------

4. 为 awstats 设置虚拟目录, 我是安装在 j:\awstats\
例:
#---------------------------------------------------
# awstats
alias /awstatsclasses "j:/awstats/wwwroot/classes/"
alias /awstatscss "j:/awstats/wwwroot/css/"
alias /awstatsicons "j:/awstats/wwwroot/icon/"
scriptalias /awstats/ "j:/awstats/wwwroot/cgi-bin/"

options +execcgi
allowoverride none
order allow,deny
allow from all

#---------------------------------------------------

5. 总结 apache httpd.conf 的设置
#---------------------------------------------------
##############################################################
## 避免对图片的请求出现在访问日志中
setenvif request_uri \.gif image-request
setenvif request_uri \.jpg image-request
setenvif request_uri \.png image-request
setenvif request_uri \.jpeg image-request

## 记录使用英语的请求到一个日志,而记录非英语的请求到另一个日志
#setenvif accept-language "en" english

#customlog logs/english_log.log common env=english
#customlog logs/non_english_log.log common env=!english
#customlog logs/access_log.log common env=!image-request

#customlog logs/access_log.log common env=!image-request
#customlog "logs/access_log.%y%m%d" combined env=!image-request
##############################################################

customlog "|bin/cronolog.exe logs/access_%y%m%d.log" combined env=!image-request

########################################################
# awstats
alias /awstatsclasses "j:/awstats/wwwroot/classes/"
alias /awstatscss "j:/awstats/wwwroot/css/"
alias /awstatsicons "j:/awstats/wwwroot/icon/"
scriptalias /awstats/ "j:/awstats/wwwroot/cgi-bin/"

options +execcgi
allowoverride none
order allow,deny
allow from all

########################################################
#---------------------------------------------------

6. 如果设置好的话, 重新启动 apache
#---------------------------------------------------
net stop apache2
net start apache2
#---------------------------------------------------

7. 一切顺利的话, 在 apache 的 log 目录应该有这样格式的日志显示
#---------------------------------------------------
access_20050309.log
#---------------------------------------------------

----------------------------------------------------
注: c:\program files\apache group\apache2\logs
----------------------------------------------------

8. 一切完成的话那就摆平 apache 方面的设置, 接着是 设置 awstats.

/-*-------------------------------------------------------------------------------------*-/

六. 设置 AWStats

1. 进入 J:\awstats\wwwroot\cgi-bin\ 目录

2. 打开 awstats.model.conf, 复制 awstats.model.conf 的内容到 awstats.gi.2288.org.conf 文件.
----------------------------------------------------
注: 我安装后 awstats.gi.2288.org.conf 里是空白的.
----------------------------------------------------

3. 查找 Logfile 字符串, 设置为:
#---------------------------------------------------
LogFile="C:\Program Files\Apache Group\Apache2\logs\access_%YYYY-24%MM-24%DD-24.log"
#---------------------------------------------------

4. 在 awstats.gi.2288.org.conf 文件里按 CTRL+F 查找 SiteDomain 字符串, 添加站点域名, 例:
#---------------------------------------------------
SiteDomain="gi.2288.org:88"
#---------------------------------------------------

5. 查找 HostAliases 字符串, 添加站点根域名, 我没有, 所以就让它成为默认状态.

6. 查找 DirData 字符串, 我的设置:
#---------------------------------------------------
DirData="."
#---------------------------------------------------

7. 查找 LoadPlugin="decodeutfkeys", 去掉前面的 # 字符, 例:
#---------------------------------------------------
#LoadPlugin="decodeutfkeys"
LoadPlugin="decodeutfkeys"
#---------------------------------------------------

8. AWStats 的设置完成大半部分了, 接着该是更新了, 要用到 Perl.
----------------------------------------------------
注: 不需要指定 Include"" 里的包含文件.
----------------------------------------------------

/-*-------------------------------------------------------------------------------------*-/

七. 更新 AWStats

1. 命令行方式 进入 Perl 安装目录的 Bin 目录, 例如我的:
#---------------------------------------------------
C:\Perl\bin>
#---------------------------------------------------

2. 运行下面的命令更新,例:
#---------------------------------------------------
perl J:\awstats\wwwroot\cgi-bin\awstats.pl -update -config=gi.2288.org
#---------------------------------------------------

显示为:
----------------------------------------------------
C:\Perl\bin>perl J:\awstats\wwwroot\cgi-bin\awstats.pl -update -config=gi.2288.
org
Update for config "J:\awstats\wwwroot\cgi-bin/awstats.gi.2288.org.conf"
With data in log file "C:\Program Files\Apache Group\Apache2\logs\access_2005030
8.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 52)
Jumped lines in file: 52
Found 52 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.

C:\Perl\bin>
----------------------------------------------------

3. 这时在 J:\awstats\wwwroot\cgi-bin 下会多了一个 awstats032005.gi.2288.org.txt 的文本文件.

4. 完成了...

/-*-------------------------------------------------------------------------------------*-/

附加: 在 AWStats 目录下有一个 DOC 目录, 里面有参考资料, 慢慢看, 还有很多用处, 我也是熟悉中.

偶的 AWSTATS 地址:

/****************************************************************\
*
* author : Emerald
*
* homepage :
*
* Seo-Gi :
*
* sitename : 绿色学院 - Green Institute
*
* date : 2005-3-9 23:06:50
*
\****************************************************************/

阅读(467) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~