如何利用AWStats针对网站自身应用进行特定参数的统计,今天学习了一下:AWStats Documentation - Using the Extra Sections features。文档中主要有以下几个例子:
# Example 1: Tracking Product orders
跟踪商品订单:解析出GET /cgi-bin/order.cgi?productid=49&session=A0B1C2 中的productid=字段
# Example 2: Tracking Bugzilla most frequently viewed bugs
跟踪bugzilla中最经常被访问的Bug:原理同上,这在内部开发中非常有用,类似的,也很容易给BBS系统配置出最常访问的论坛等统计。
# Example 3: Tracking Exit clicks
跟踪用户离开当前网站的点击:前提是你将所有指向其他网站的链接通过/cgi-bin/awredir.pl?url=http://externalsite/pagelinked这样的链接进行部署。
# Example 4: Tracking aborted download
跟踪中断的下载:利用的是HTTP返回的状态码206 ExtraSectionCodeFilter1="206"
# Example 5: Tracking most requested domain aliases
跟踪最常用的域名别名:这需要在日志中部署并定义扩展字段%your_extra_field,然后在ExtraSestion中部署统计相应的扩展字段%your_extra_field 这里的例子就是将域名的别名,在一个域名有多个别名的时候,分析那个域名最常用最有帮助。
# Example 6: List of top level 2 path under a directory /mydir
跟踪某个目录下最常访问的2级子目录,根据样例设置了一个 /tech /blog 2个目录下的TOP文章统计。
增加的配置如下
ExtraSectionName1="Top aticles under /tech"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,^\/tech\/.*"
ExtraSectionFirstColumnTitle1="Article Name"
ExtraSectionFirstColumnValues1="URL,^\/tech\/([\w]+)\.html"
ExtraSectionFirstColumnFormat1="<a href='/tech/%s.html' target='new'>%s</a>"
ExtraSectionStatTypes1=PHL
MaxNbOfExtra2=20
MinHitExtra2=1
样例输出:
Article Name | 网页数 | 文件数 | 最近参观日期 |
---|---|---|---|
awstats | 80 | 80 | 2005年 十一月 27日 13:20 |
49 | 49 | 2005年 十一月 27日 13:13 | |
google_url | 42 | 42 | 2005年 十一月 27日 13:12 |
cvs_card | 36 | 36 | 2005年 十一月 27日 13:24 |
lucene | 30 | 30 | 2005年 十一月 27日 13:22 |
cms | 26 | 26 | 2005年 十一月 27日 13:11 |
link_pop_check | 25 | 25 | 2005年 十一月 27日 13:13 |
apache_install | 24 | 24 | 2005年 十一月 27日 13:13 |
google_ads | 21 | 21 | 2005年 十一月 27日 13:16 |
weblucene | 18 | 18 | 2005年 十一月 27日 13:13 |
indent_tools | 18 | 18 | 2005年 十一月 27日 12:57 |
cache | 17 | 17 | 2005年 十一月 27日 13:17 |
hello_unicode | 14 | 14 | 2005年 十一月 27日 13:18 |
study | 12 | 12 | 2005年 十一月 27日 13:29 |
resin | 11 | 11 | 2005年 十一月 27日 13:20 |
rotate_merge_log | 11 | 11 | 2005年 十一月 27日 12:02 |
mysql | 11 | 11 | 2005年 十一月 27日 13:02 |
ant | 9 | 9 | 2005年 十一月 27日 12:40 |
xslt | 8 | 8 | 2005年 十一月 27日 12:55 |
weblog | 8 | 8 | 2005年 十一月 27日 12:34 |
ExtraSectionName2="Top aticles under /blog/archives/"
ExtraSectionCodeFilter2="200 304"
ExtraSectionCondition2="URL,^\/blog\/archives\/.*"
ExtraSectionFirstColumnTitle2="Article Name"
ExtraSectionFirstColumnValues2="URL,^\/blog\/archives\/([\d]+)\.html"
ExtraSectionFirstColumnFormat2="<a href='/blog/archives/%s.html' target='new'>%s</a>"
ExtraSectionStatTypes2=PHL
MaxNbOfExtra2=20
MinHitExtra2=1
Article ID | 网页数 | 文件数 | 最近参观日期 |
---|---|---|---|
000432 | 43 | 43 | 2005年 十一月 27日 13:14 |
000741 | 39 | 39 | 2005年 十一月 27日 13:23 |
001065 | 38 | 38 | 2005年 十一月 27日 13:28 |
001070 | 38 | 38 | 2005年 十一月 27日 13:27 |
001071 | 38 | 38 | 2005年 十一月 27日 13:26 |
001058 | 31 | 31 | 2005年 十一月 27日 12:58 |
000825 | 19 | 19 | 2005年 十一月 27日 13:28 |
000728 | 16 | 16 | 2005年 十一月 27日 13:17 |
000772 | 15 | 15 | 2005年 十一月 27日 12:33 |
000515 | 15 | 15 | 2005年 十一月 27日 13:26 |
000638 | 15 | 15 | 2005年 十一月 27日 13:25 |
000950 | 14 | 14 | 2005年 十一月 27日 13:09 |
001060 | 13 | 13 | 2005年 十一月 27日 12:52 |
000878 | 13 | 13 | 2005年 十一月 27日 12:45 |
000655 | 11 | 11 | 2005年 十一月 27日 12:24 |
000790 | 11 | 11 | 2005年 十一月 27日 13:26 |
000945 | 11 | 11 | 2005年 十一月 27日 13:29 |
000661 | 11 | 11 | 2005年 十一月 27日 11:55 |
000651 | 11 | 11 | 2005年 十一月 27日 09:57 |
000646 | 11 | 11 | 2005年 十一月 27日 13:24 |
改进建议: 发现了一个样例,解决了。
目前的扩展输出能够统计出ID,但是要点击回原有的链接还是很麻烦,希望AWStats能提供相应的模板,让统计出来的ID能还原回URL,以方便点击反查。当然AWStats本身也提供了CSV/XML等格式的输出,可以自己做一些统计扩展来实现这些功能。
# 注释:统计列说明,在ExtraSectionStatTypes中只有PHBL这几个字段有效
# U = Unique visitors
# V = Visits
# P = Number of pages
# H = Number of hits (or mails)
# B = Bandwith (or total mail size for mail logs)
# L = Last access date
# E = Entry pages
# X = Exit pages
# C = Web compression (mod_gzip,mod_deflate)
AWStats统计工具安装和配置:
http://chedong.com/tech/awstats.html
和MT/WP这些发布系统一样,AWStats也是非常适合中小网站的统计系统。虽然速度和效率上不如WebAlizer/Analog (AWStats在统计百万级访问量的网站时已经很吃力了),但是AWStats所提供的功能却是WebAlizer/Analog远远不及的。所以遇到效率问题的时候,解决的方法不一定是如何找到效率更高的千万级的网站统计系统,将网站分解成多个子频道也是一个可行的办法。
2009-12-22更新: 有道,搜狗,MSN,搜搜,Google,百度和雅虎蜘蛛的统计代码:
作者:车东 发表于:2009-12-22 12:12 最后更新于:2009-12-22 09:12
ExtraTrackedRowsLimit=20000ExtraSectionName1="OutfoxBot/YoudaoBot crawls - Top 20"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="UA,(.*Youdao.*)"
ExtraSectionFirstColumnValues1="URL,(.*)"
ExtraSectionFirstColumnFormat1="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes1=HBL
MaxNbOfExtra1=20
MinHitExtra1=1ExtraSectionName2="Sogou crawls - Top 20"
ExtraSectionCodeFilter2="200 304"
ExtraSectionCondition2="UA,(.*Sogou.*)"
ExtraSectionFirstColumnValues2="URL,(.*)"
ExtraSectionFirstColumnFormat2="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes2=HBL
MaxNbOfExtra2=20
MinHitExtra2=1ExtraSectionName3="MSN crawls - Top 20"
ExtraSectionCodeFilter3="200 304"
ExtraSectionCondition3="UA,(.*msnbot.*)"
ExtraSectionFirstColumnValues3="URL,(.*)"
ExtraSectionFirstColumnFormat3="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes3=HBL
MaxNbOfExtra3=20
MinHitExtra3=1ExtraSectionName4="Sosospider crawls - Top 20"
ExtraSectionCodeFilter4="200 304"
ExtraSectionCondition4="UA,(.*Sosospider.*)"
ExtraSectionFirstColumnValues4="URL,(.*)"
ExtraSectionFirstColumnFormat4="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes4=HBL
MaxNbOfExtra4=20
MinHitExtra4=1ExtraSectionName5="Google crawls - Top 20"
ExtraSectionCodeFilter5="200 304"
ExtraSectionCondition5="UA,(.*Google.*)"
ExtraSectionFirstColumnValues5="URL,(.*)"
ExtraSectionFirstColumnFormat5="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes5=HBL
MaxNbOfExtra5=20
MinHitExtra5=1ExtraSectionName6="Baidu crawls - Top 20"
ExtraSectionCodeFilter6="200 304"
ExtraSectionCondition6="UA,(.*Baidu.*)"
ExtraSectionFirstColumnValues6="URL,(.*)"
ExtraSectionFirstColumnFormat6="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes6=HBL
MaxNbOfExtra6=20
MinHitExtra6=1ExtraSectionName7="Yahoo Slurp crawls - Top 20"
ExtraSectionCodeFilter7="200 304"
ExtraSectionCondition7="UA,(.*Slurp.*)"
ExtraSectionFirstColumnValues7="URL,(.*)"
ExtraSectionFirstColumnFormat7="<a href='%s' title='Item Crawled' target='_blank'>%s</a>"
ExtraSectionStatTypes7=HBL
MaxNbOfExtra7=20
MinHitExtra7=1
版权声明:可以转载,转载时请务必以超链接形式标明文章 AWStats的自定义扩展统计:Using the Extra Sections features 的原始出处和作者信息及本版权声明。
http://www.chedong.com/blog/archives/001073.html
Comments
东哥:
我的win2k+resin+awstats是否也能实现自定义扩展统计,
请教一下!!!
由: 小小弟 发表于 2006年04月12日 下午05时21分
你好,车东,前不久曾经请教过你关于AWStats的问题,我们的网站原先装有AWStats,一切正常,4月份21日起网页上所有数据都变为了0。今天我看了下日志文件,发现4.21日后的log文件中的日期都变成了2006-6-30,时间都为03:28:14,我复制了三行内容如下,而之前的都与当日日期相符,并且时间从00:00到24:00,不知这个是什么原因,应该怎么解决?希望你能帮帮我,谢谢了!
“#Fields: date time cs-method cs-uri-stem cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes cs-bytes
2006-06-30 03:28:14 GET /Default.aspx - 61.183.16.53 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1) http://ent.sina.com.cn/y/2006-05-21/01381088342.html 200 19138 270
2006-06-30 03:28:14 GET /lycos.css - 61.183.16.53 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1) http://www.marvelon.com.cn/ 200 16777 254
2006-06-30 03:28:14 GET /js/textfloat.js - 61.183.16.53 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5
由: helen 发表于 2006年06月14日 下午01时43分
你好,车东:
请教一下,awstats可不可以对某段url,如www.localhost.com/test,单独配一个配置文件进行统计,使他出来的统计信息和统计某个域名www.localhost.com效果一样。
由: woyo 发表于 2006年10月19日 下午01时32分
车东兄,我的Extra Sections features需要统计一个汉字,但是无论如何它都不支持浪个办?
linux系统local=utf8,打开了LoadPlugin="decodeutfkeys,搜索引擎都能正常显示汉字的说。我就简单的按照ex1上面的:
ExtraSectionName2="Product orders"
ExtraSectionCodeFilter2="200 304"
ExtraSectionCondition2="URL,\/s\/download"
ExtraSectionFirstColumnTitle2="kerword"
ExtraSectionFirstColumnValues2="QUERY_STRING,keyword=([^&]+)"
ExtraSectionFirstColumnFormat2="%s"
ExtraSectionStatTypes2=P
ExtraSectionAddAverageRow2=0
ExtraSectionAddSumRow2=0
MaxNbOfExtra2=20
MinHitExtra2=10
但是结果是不能统计出汉字来,
但是如果我修改用数字的
#ExtraSectionFirstColumnValues2="QUERY_STRING,pid=([^&]+)"
就能统计出一个结果来的
浪个办啊
由: chinetman 发表于 2008年09月04日 上午10时26分
隔了快一年了,终于有新文了
由: donghao 发表于 2009年12月22日 下午03时29分
说的不错。有关于统计扩展的专业文章么?
由: 涂鸦 发表于 2010年02月07日 下午02时19分