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]