From: eldy <> Date: Thu, 30 Oct 2003 13:31:08 +0000 (+0000) Subject: Can use UA and HOST fields to build personalized ExtraSection reports X-Git-Tag: AWSTATS_6_0_BETA~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dbaf41bd9069eab7d73736db4e146901aefaa63;p=thirdparty%2FAWStats.git Can use UA and HOST fields to build personalized ExtraSection reports --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index 098da0d3..6e40cd84 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -19,6 +19,7 @@ New features/improvements: - Add percent column for file types. - Some changes to make AWStats to be XML compliant ready. Need to set the new parameter UseXMLForOutput to 1 in config file. +- Can use UA and HOST fields to build personalized ExtraSection reports. Other/Documentation: - Prepare code for decodeUTFkeys plugin. diff --git a/docs/awstats_config.html b/docs/awstats_config.html index 86bdd48c..afba1ff0 100644 --- a/docs/awstats_config.html +++ b/docs/awstats_config.html @@ -1614,13 +1614,15 @@ color_u,color_v,color_p,color_h,color_k,color_s

# In most cases, you don't need this feature.
#
# ExtraSectionNameX is title of your personalized chart. -
# ExtraSectionConditionalX are conditions on URL and/or QUERY_STRING and/or -
# REFERER you can use to count or not the hit. Use "|" for "OR". +
# ExtraSectionConditionalX are conditions you can use to count or not the hit, +
# Use one of the field condition (URL, QUERY_STRING, REFERER, UA, HOST) +
# and string to match after a coma. Use "|" for "OR".
# ExtraSectionFirstColumnTitleX is the first column title of the chart. -
# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats how to -
# extract the value used for first column. Each different value found will -
# be a different row. Be sure that list of different values is "limited" to -
# avoid "not enough memory" problems ! +
# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats in which +
# field to extract value from (URL, QUERY_STRING, REFERER, UA, HOST) and how +
# to extract the value. Each different value found will appear in first +
# column of report on a different row. Be sure that list of different values +
# is "limited" to avoid "not enough memory" problems !
# 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). diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index 63c86e59..aefbe730 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -1221,13 +1221,15 @@ color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2 # In most cases, you don't need this feature. # # ExtraSectionNameX is title of your personalized chart. -# ExtraSectionConditionalX are conditions on URL and/or QUERY_STRING and/or -# REFERER you can use to count or not the hit. Use "|" for "OR". +# ExtraSectionConditionalX are conditions you can use to count or not the hit, +# Use one of the field condition (URL, QUERY_STRING, REFERER, UA, HOST) +# and string to match after a coma. Use "|" for "OR". # ExtraSectionFirstColumnTitleX is the first column title of the chart. -# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats how to -# extract the value used for first column. Each different value found will -# be a different row. Be sure that list of different values is "limited" to -# avoid "not enough memory" problems ! +# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats in which +# field to extract value from (URL, QUERY_STRING, REFERER, UA, HOST) and how +# to extract the value. Each different value found will appear in first +# column of report on a different row. Be sure that list of different values +# is "limited" to avoid "not enough memory" problems ! # 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). diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index ee919196..85868c5c 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -6398,6 +6398,14 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat if ($Debug) { debug(" Check condition '$conditiontype' must contain '$conditiontypeval' in $field[$pos_referer]",5); } if ($field[$pos_referer] =~ m/$conditiontypeval/) { $conditionok=1; last; } } + elsif ($conditiontype eq 'UA') { + if ($Debug) { debug(" Check condition '$conditiontype' must contain '$conditiontypeval' in $field[$pos_ua]",5); } + if ($field[$pos_ua] =~ m/$conditiontypeval/) { $conditionok=1; last; } + } + elsif ($conditiontype eq 'HOST') { + if ($Debug) { debug(" Check condition '$conditiontype' must contain '$conditiontypeval' in $field[$pos_host]",5); } + if ($HostResolved =~ m/$conditiontypeval/) { $conditionok=1; last; } + } else { error("Wrong value of parameter ExtraSectionCondition$extranum"); } } if (! $conditionok && @{$ExtraConditionType[$extranum]}) { next; } # End for this section @@ -6419,6 +6427,12 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat elsif ($rowkeytype eq 'REFERER') { if ($field[$pos_referer] =~ m/$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; } } + elsif ($rowkeytype eq 'UA') { + if ($field[$pos_ua] =~ m/$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; } + } + elsif ($rowkeytype eq 'HOST') { + if ($HostResolved =~ m/$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; } + } else { error("Wrong value of parameter ExtraSectionFirstColumnValues$extranum"); } } if (! $rowkeyok) { next; } # End for this section