天天看点

awstats日志分析小结(2)

awstats以默认方式对日志统计分析的时候,有时无法满足我们业务的需求(对URL中某些参数进行统计分析)。所以需要对awstats扩展部分进行定义,从而使其满足我们的需要。

awstats.xxx.conf关于EXTRA SECTIONS的描述部分

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

# EXTRA SECTIONS

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

# You can define your own charts, you choose here what are rows and columns

# keys. This feature is particularly useful for marketing purpose, tracking

# products orders for example.

# For this, edit all parameters of Extra section. Each set of parameter is a

# different chart. For several charts, duplicate section changing the number.

# Note: Each Extra section reduces AWStats speed by 8%.

#

# WARNING: A wrong setup of Extra section might result in too large arrays

# that will consume all your memory, making AWStats unusable after several

# updates, so be sure to setup it correctly.

# In most cases, you don't need this feature.

#

# ExtraSectionNameX is title of your personalized chart.

# ExtraSectionCodeFilterX is list of codes the record code field must match.

# Put an empty string for no test on code.

# ExtraSectionConditionX are conditions you can use to count or not the hit,

# Use one of the field condition

# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,extraX)

# and a regex to match, after a coma. Use "||" for "OR".

# ExtraSectionFirstColumnTitleX is the first column title of the chart.

# ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to

# extract value from

# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,VHOST,extraX)

# and how to extract the value (using regex syntax). Each different value

# found will appear in first column of report on a different row. Be sure

# that list of different possible values will not grow indefinitely.

# ExtraSectionFirstColumnFormatX is the string used to write value.

# ExtraSectionStatTypesX are things you want to count. You can use standard

# code letters (P for pages,H for hits,B for bandwidth,L for last access).

# ExtraSectionAddAverageRowX add a row at bottom of chart with average values.

# ExtraSectionAddSumRowX add a row at bottom of chart with sum values.

# MaxNbOfExtraX is maximum number of rows shown in chart.

# MinHitExtraX is minimum number of hits required to be shown in chart.

#

# Example to report the 20 products the most ordered by "order.cgi" script

#ExtraSectionName1="Product orders"

#ExtraSectionCodeFilter1="200 304"

#ExtraSectionCondition1="URL,\/cgi\-bin\/order\.cgi||URL,\/cgi\-bin\/order2\.cgi"

#ExtraSectionFirstColumnTitle1="Product ID"

#ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"

#ExtraSectionFirstColumnFormat1="%s"

#ExtraSectionStatTypes1=PL

#ExtraSectionAddAverageRow1=0

#ExtraSectionAddSumRow1=1

#MaxNbOfExtra1=20

#MinHitExtra1=1

在我们的项目中需要对包含某些特定参数的部分进行统计,如下是我们实际项目中配置文件添加的部分。

#扩展表格1的标题

ExtraSectionName1="Product orders scene"

#过滤返回码 200,304的纪录

ExtraSectionCodeFilter1="200 304"

#过滤URL包含dataservlet 或 sceneservlet的纪录

ExtraSectionCondition1="URL,dataservlet||URL,sceneservlet"

#标题名称

ExtraSectionFirstColumnTitle1="scene"

#过滤参数为scene

ExtraSectionFirstColumnValues1="QUERY_STRING,scene=([^&]+)"

ExtraSectionFirstColumnFormat1="%s"

ExtraSectionStatTypes1=1

ExtraSectionAddAverageRow1=1

ExtraSectionAddSumRow1=1

MaxNbOfExtra1=20

MinHitExtra1=1

#扩展表格2的标题

ExtraSectionName2="Product orders vmethod"

ExtraSectionCodeFilter2="200 304"

ExtraSectionCondition2="URL,dataservlet||URL,sceneservlet"

ExtraSectionFirstColumnTitle2="vmethod"

ExtraSectionFirstColumnValues2="QUERY_STRING,vmethod=([^&]+)"

ExtraSectionFirstColumnFormat2="%s"

ExtraSectionStatTypes2=1

ExtraSectionAddAverageRow2=1

ExtraSectionAddSumRow2=1

MaxNbOfExtra2=20

MinHitExtra2=1

#扩展表格3的标题

ExtraSectionName3="Product orders dataset"

ExtraSectionCodeFilter3="200 304"

ExtraSectionCondition3="URL,dataservlet||URL,sceneservlet"

ExtraSectionFirstColumnTitle3="dataset"

ExtraSectionFirstColumnValues3="QUERY_STRING,dataset=([^&]+)"

ExtraSectionFirstColumnFormat3="%s"

ExtraSectionStatTypes3=1

ExtraSectionAddAverageRow3=1

ExtraSectionAddSumRow3=1

MaxNbOfExtra3=20

MinHitExtra3=1

注意各个参数以已1,2,3...结尾,分别标示为各扩展表的属性。

[img]http://masterkey.iteye.com/topics/download/58d5ffb0-e8f4-3a80-9291-bebe4ad45aa6[/img]