From: eldy <> Date: Wed, 14 Jul 2004 16:01:44 +0000 (+0000) Subject: You can use a particular not used field in your log file to build X-Git-Tag: AWSTATS_6_3_RELEASE~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98f5f61ae39b4baf20d053923bbc562f2c9eca8d;p=thirdparty%2FAWStats.git You can use a particular not used field in your log file to build a personalized report with the ExtraSection feature. Just use a personalized log format and use the tag %extraX (where X is a number) to name field you want to use, then, in ExtraSection parmaters, you can use extraX to tell wich info to use to extract data for building the chart. --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index 6ba7252e..af8036c1 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -20,6 +20,11 @@ in default distrib. You can download it from AWStats web site). in mode "NewLine". No need to find a more recent record for this. This means the NotSortedRecordTolerance works even between end and start of updates. +- You can use a particular not used field in your log file to build +a personalized report with the ExtraSection feature. Just use a personalized +log format and use the tag %extraX (where X is a number) to name field you +want to use, then, in ExtraSection parmaters, you can use extraX to tell +wich info to use to extract data for building the chart. Fixes: - Fix not recognized %time3 tag in LogFormat. This tag allows to process diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index 80387618..1a2ab16c 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -1,4 +1,4 @@ -# AWSTATS CONFIGURE FILE 6.0 +# AWSTATS CONFIGURE FILE 6.2 #----------------------------------------------------------------------------- # Copy this file into awstats.www.mydomain.conf and edit this new config file # to setup AWStats (See documentation in docs/ directory). @@ -103,9 +103,12 @@ LogType=W # contains data of several virtual web servers. AWStats # will discard records not in SiteDomain nor HostAliases # %cluster If log file is provided from several computers (merged by -# logresolvemerge.pl), this tag define field of cluster id. +# logresolvemerge.pl), use this to define cluster id field. +# %extraX Another field that you plan to use for building a +# personalized report with ExtraSection feature (See later). # If your log format has some fields not included in this list, use: -# %other Means another field not used +# %other Means another not used field +# %otherquot Means another not used double quoted field # # Examples for Apache combined logs (following two examples are equivalent): # LogFormat = 1 @@ -1311,11 +1314,11 @@ color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2 # 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,QUERY_STRING,REFERER,UA,HOST) +# Use one of the field condition (URL,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 Regex string to tell AWStats in which -# field to extract value from (URL,QUERY_STRING,REFERER,UA,HOST) +# ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to +# extract value from (URL,QUERY_STRING,REFERER,UA,HOST,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. diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index cb21fd8f..273a46dd 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -60,7 +60,7 @@ $FrameName $Center $FileConfig $FileSuffix $Host $DayRequired $MonthRequired $Ye $QueryString $SiteConfig $StaticLinks $PageCode $PageDir $PerlParsingFormat $UserAgent $pos_vh $pos_host $pos_logname $pos_date $pos_tz $pos_method $pos_url $pos_code $pos_size $pos_referer $pos_agent $pos_query $pos_gzipin $pos_gzipout $pos_compratio -$pos_cluster $pos_emails $pos_emailr $pos_hostr +$pos_cluster $pos_emails $pos_emailr $pos_hostr @pos_extra /; $DIR=$PROG=$Extension=''; $Debug = $ShowSteps = 0; @@ -81,6 +81,7 @@ $QueryString, $SiteConfig, $StaticLinks, $PageCode, $PageDir, $PerlParsingFormat $pos_vh = $pos_host = $pos_logname = $pos_date = $pos_tz = $pos_method = $pos_url = $pos_code = $pos_size = -1; $pos_referer = $pos_agent = $pos_query = $pos_gzipin = $pos_gzipout = $pos_compratio = -1; $pos_cluster = $pos_emails = $pos_emailr = $pos_hostr = -1; +@pos_extra=(); # ----- Plugins variable ----- use vars qw/ %PluginsLoaded $PluginDir $AtLeastOneSectionPlugin /; %PluginsLoaded=(); @@ -5052,6 +5053,11 @@ sub DefinePerlParsingFormat { $PerlParsingFormat .= "([^$LogSeparatorWithoutStar]+)"; } } + # Extra tag + elsif ($f =~ /%extra(\d+)$/) { + $pos_extra[$1] = $i; $i++; push @fieldlib, "extra$1"; + $PerlParsingFormat .= "([^$LogSeparatorWithoutStar]+)"; + } # Other tag elsif ($f =~ /%other$/) { $PerlParsingFormat .= "[^$LogSeparatorWithoutStar]+"; @@ -6229,7 +6235,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat foreach (split(/&/,$standalonequery)) { if ($_ =~ /^screen=(\d+)x(\d+)/i) { $foundparam++; $_screensize_h{"$1x$2"}++; next; } #if ($_ =~ /cdi=(\d+)/i) { $foundparam++; $_screendepth_h{"$1"}++; next; } - if ($_ =~ /^nojs=(\w+)/i) { $foundparam++; if ($1 eq 'y') { $_misc_h{"JavaScriptDisabled"}++; } next; } + if ($_ =~ /^nojs=(\w+)/i) { $foundparam++; if ($1 eq 'y') { $_misc_h{"JavascriptDisabled"}++; } next; } if ($_ =~ /^java=(\w+)/i) { $foundparam++; if ($1 eq 'true') { $_misc_h{"JavaEnabled"}++; } next; } if ($_ =~ /^shk=(\w+)/i) { $foundparam++; if ($1 eq 'y') { $_misc_h{"DirectorSupport"}++; } next; } if ($_ =~ /^fla=(\w+)/i) { $foundparam++; if ($1 eq 'y') { $_misc_h{"FlashSupport"}++; } next; } @@ -6960,6 +6966,10 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat if ($Debug) { debug(" Check condition '$conditiontype' must contain '$conditiontypeval' in '$field[$pos_host]'",5); } if ($HostResolved =~ /$conditiontypeval/) { $conditionok=1; last; } } + elsif ($conditiontype =~ /extra(\d+)/i) { + if ($Debug) { debug(" Check condition '$conditiontype' must contain '$conditiontypeval' in '$field[$pos_extra[$1]]'",5); } + if ($field[$pos_extra[$1]] =~ /$conditiontypeval/) { $conditionok=1; last; } + } else { error("Wrong value of parameter ExtraSectionCondition$extranum"); } } if (! $conditionok && @{$ExtraConditionType[$extranum]}) { next; } # End for this section @@ -6987,6 +6997,9 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat elsif ($rowkeytype eq 'HOST') { if ($HostResolved =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; } } + elsif ($rowkeytype =~ /extra(\d+)/i) { + if ($field[$pos_extra[$1]] =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; } + } else { error("Wrong value of parameter ExtraSectionFirstColumnValues$extranum"); } } if (! $rowkeyok) { next; } # End for this section @@ -7003,7 +7016,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat if (scalar keys %{'_section_' . $extranum . '_h'} > $ExtraTrackedRowsLimit) { error(< "; print " "; print "\n"; - my %label=('AddToFavourites'=>$Message[137],'JavaScriptDisabled'=>$Message[168],'JavaEnabled'=>$Message[140],'DirectorSupport'=>$Message[141], + my %label=('AddToFavourites'=>$Message[137],'JavascriptDisabled'=>$Message[168],'JavaEnabled'=>$Message[140],'DirectorSupport'=>$Message[141], 'FlashSupport'=>$Message[142],'RealPlayerSupport'=>$Message[143],'QuickTimeSupport'=>$Message[144], 'WindowsMediaPlayerSupport'=>$Message[145],'PDFSupport'=>$Message[146]); foreach my $key (@MiscListOrder) {