]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fix: If condition ok for extrasection but key can't be found, we used the key "Failed...
authoreldy <>
Fri, 23 Nov 2007 19:18:02 +0000 (19:18 +0000)
committereldy <>
Fri, 23 Nov 2007 19:18:02 +0000 (19:18 +0000)
New: Add condition HOSTINLOG

docs/awstats_extra.html
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl

index 47ebd94484a4d32e0b64a9365e6f8ba0d85e702c..99d5bb23ebe7094a72f3169a88d3ab299b9c5b8e 100644 (file)
@@ -314,11 +314,13 @@ There is a lot of other possible use for Extra Sections ...<br>
 <br># ExtraSectionCodeFilterX is list of codes the record code field must match.
 <br>#   Put an empty string for no test on code.
 <br># ExtraSectionConditionX are conditions you can use to count or not the hit,
-<br>#   Use one of the field condition (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,
-<br>#   HOST,extraX) and a regex to match, after a coma. Use "||" for "OR".
+<br>#   Use one of the field condition
+<br>#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,HOST,VHOST,extraX)
+<br>#   and a regex to match, after a coma. Use "||" for "OR".
 <br># ExtraSectionFirstColumnTitleX is the first column title of the chart.
 <br># ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to
-<br>#   extract value from (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,extraX)
+<br>#   extract value from
+<br>#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,HOST,VHOST,extraX)
 <br>#   and how to extract the value (using regex syntax). Each different value
 <br>#   found will appear in first column of report on a different row. Be sure
 <br>#   that list of different possible values will not grow indefinitely.
index 7bab888e46149fd01a12257e31ccd8b6a0f27d09..6a524cd1f1fb4cafdb3aed57340a385ae223eb08 100644 (file)
@@ -177,7 +177,7 @@ HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
 # dramatically AWStats update process speed. Do not use on large web sites.
 # Note: Reverse DNS lookup is done on IPv4 only (Enable ipv6 plugin for IPv6).
 # Note: Result of DNS Lookup can be used to build the Country report. However
-# it is highly recommanded to enable the plugin 'geoipfree' or 'geoip' to
+# it is highly recommanded to enable the plugin 'geoip' or 'geoipfree' to
 # have an accurate Country report with no need of DNS Lookup.
 # Possible values:
 # 0 - No DNS Lookup
@@ -1279,7 +1279,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # This plugin gives AWStats capability to make reverse DNS lookup on IPv6
 # addresses.
 # Note: If you are interested in having country report, you should use the
-# geoipfree or geoip plugin instead of enabled reverse DNS lookup.
+# geoip or geoipfree plugin instead of enabled reverse DNS lookup.
 #
 #LoadPlugin="ipv6"
 
@@ -1295,8 +1295,11 @@ color_x="C1B2E2"                         # Background color for number of exit pages (Default = "C1B2
 # Country chart is built from an Internet IP-Country database.
 # This plugin is useless for intranet only log files.
 # Note: You must choose between using this plugin (need Perl Geo::IP module 
-# from Maxmind, database more up to date) or the GeoIPfree plugin (need
-# Perl Geo::IPfree module, database less up to date).
+# from Maxmind, database is free and up to date) or the GeoIPfree plugin
+# (need Perl Geo::IPfree module, database is free but not up to date).
+# There is two versions of Maxmind Country Database:
+# You can get a free version or purchase a license from Maxmind to get/use a more
+# accurate version including updates (http://www.maxmind.com/app/perl?rId=awstat)
 # This plugin reduces AWStats speed of 8% !
 #
 #LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
@@ -1306,8 +1309,8 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # Country chart is built from an Internet IP-Country database.
 # This plugin is useless for intranet only log files.
 # Note: You must choose between using this plugin (need Perl Geo::IPfree
-# module, database less up to date) or the GeoIP plugin (need Perl Geo::IP
-# module from Maxmind, database more up to date).
+# module, database is free but not up to date) or the GeoIP plugin (need
+# Perl Geo::IP module from Maxmind, database is also free and up to date).
 # Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
 # module, so install it from elsewhere (from www.cpan.org for example).
 # This plugin reduces AWStats speed of 10% !
@@ -1333,7 +1336,9 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # Note: This plugin need Maxmind GeoIP Perl module AND the city database.
 # Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
 # on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the City database.
+# There is two versions of Maxmind City Database:
+# You can get a free version or purchase a license from Maxmind to get/use a more
+# accurate version including updates (http://www.maxmind.com/app/perl?rId=awstat)
 # This plugin reduces AWStats speed.
 #
 #LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
@@ -1449,12 +1454,12 @@ color_x="C1B2E2"                                # Background color for number of exit pages (Default = "C1B2
 #   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)
+#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,HOST,VHOST,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)
+#   (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOSTINLOG,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.
index 9b28331400edb0a139c0f3becaad25319f53b964..dd0c7f2c61f634d59d0420bbe83c18a17f121d6b 100644 (file)
@@ -3494,7 +3494,7 @@ sub Save_History {
                $lastlinechecksum=$LastLineChecksum;
        }
        
-       if ($Debug) { debug(" Save_History [sectiontosave=$sectiontosave,year=$year,month=$month,lastlinenb=$lastlinenb,lastlineoffset=$lastlineoffset,lastlinechecksum=$lastlinechecksum]",1); }
+       if ($Debug) { debug(" Save_History [sectiontosave=$sectiontosave,year=$year,month=$month,breakdate=$breakdate,lastlinenb=$lastlinenb,lastlineoffset=$lastlineoffset,lastlinechecksum=$lastlinechecksum]",1); }
        my $spacebar="                    ";
        my %keysinkeylist=();
 
@@ -6861,7 +6861,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') {  # Updat
                # Do DNS lookup
                #--------------
                my $Host=$field[$pos_host];
-               my $HostResolved='';
+               my $HostResolved='';    # HostResolved will be defined in next paragraf if countedtraffic is true
 
                if (! $countedtraffic) {
                        my $ip=0;
@@ -7373,6 +7373,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') {  # Updat
                        $_cluster_k{$field[$pos_cluster]}+=int($field[$pos_size]);                      #Count accesses for page (kb)
                }
 
+
                # Analyze: Extra
                #---------------
                foreach my $extranum (1..@ExtraName-1) {
@@ -7415,9 +7416,14 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat
                                        if ($Debug) { debug("  Check condition '$conditiontype' must contain '$conditiontypeval' in '$field[$pos_agent]'",5); }
                                        if ($field[$pos_agent] =~ /$conditiontypeval/) { $conditionok=1; last; }
                                }
-                               elsif ($conditiontype eq 'HOST') {
+                               elsif ($conditiontype eq 'HOSTINLOG') {
                                        if ($Debug) { debug("  Check condition '$conditiontype' must contain '$conditiontypeval' in '$field[$pos_host]'",5); }
-                                       if ($HostResolved =~ /$conditiontypeval/) { $conditionok=1; last; }
+                                       if ($field[$pos_host] =~ /$conditiontypeval/) { $conditionok=1; last; }
+                               }
+                               elsif ($conditiontype eq 'HOST') {
+                                       my $hosttouse=($HostResolved?$HostResolved:$Host);
+                                       if ($Debug) { debug("  Check condition '$conditiontype' must contain '$conditiontypeval' in '$hosttouse'",5); }
+                                       if ($hosttouse =~ /$conditiontypeval/) { $conditionok=1; last; }
                                }
                                elsif ($conditiontype eq 'VHOST') {
                                        if ($Debug) { debug("  Check condision '$conditiontype' must contain '$conditiontypeval' in '$field[$pos_vh]'",5); }
@@ -7454,8 +7460,12 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat
                                elsif ($rowkeytype eq 'UA') {
                                        if ($field[$pos_agent] =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; }
                                }
+                               elsif ($rowkeytype eq 'HOSTINLOG') {
+                                       if ($field[$pos_host] =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; }
+                               }
                                elsif ($rowkeytype eq 'HOST') {
-                                       if ($HostResolved =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; }
+                                       my $hosttouse=($HostResolved?$HostResolved:$Host);
+                                       if ($hosttouse =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; }
                                }
                                elsif ($rowkeytype eq 'VHOST') {
                                        if ($field[$pos_vh] =~ /$rowkeytypeval/) { $rowkeyval = "$1"; $rowkeyok = 1; last; }
@@ -7465,8 +7475,9 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') {  # Updat
                                }
                                else { error("Wrong value of parameter ExtraSectionFirstColumnValues$extranum"); }
                        }
-                       if (! $rowkeyok) { next; }      # End for this section
-                       if ($Debug) { debug("  Key val was found: $rowkeyval",5); }
+                       if (! $rowkeyok)  { next; }                                                                     # End for this section
+                       if (! $rowkeyval) { $rowkeyval='Failed to extract key'; }
+                       if ($Debug) { debug("  Key val found: $rowkeyval",5); }
 
                        # Apply function on $rowkeyval
                        if ($ExtraFirstColumnFunction[$extranum])