]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Can add regex values for a lot of list parameters (HostAliases, SkipDNSLookupFor...
authoreldy <>
Sat, 31 May 2003 15:04:00 +0000 (15:04 +0000)
committereldy <>
Sat, 31 May 2003 15:04:00 +0000 (15:04 +0000)
Fixes: Added the "Other" line when list for unkown os and browsers were limited to a lower value than number of unknown os or browsers.
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl

index 0b8bdef7dd32ac42d59214bb389c81b114251a76..486b6346685849cbc09f8d0030c74ba700638861 100644 (file)
@@ -132,13 +132,14 @@ SiteDomain=""
 # aliases someone can use to access your site. Try to keep only the minimum
 # number of possible names/addresses to have the best performances.
 # You can repeat the "SiteDomain" value in this list.
-# Use space between each value.
 # This parameter is used to analyze referer field in log file and to help
 # AWStats to know if a referer URL is a local URL of same site or an URL of
 # another site.
-# Example: "www.myserver.com x.y.z.w localhost 127.0.0.1"
+# Note: Use space between each value.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Example: "www.myserver.com localhost 127.0.0.1 REGEX[\.mydomain\.(net|org)$]"
 #
-HostAliases="www.myserver.com x.y.z.w localhost 127.0.0.1"
+HostAliases="localhost 127.0.0.1 REGEX[^.*\.myserver\.com$]"
 
 
 # If you want to have hosts reported by name instead of ip address, AWStats
@@ -258,13 +259,12 @@ DNSStaticCacheFile="dnscache.txt"
 DNSLastUpdateCacheFile="dnscachelastupdate.txt"
 
 
-# You can specify specific IP addresses that should NOT be looked up in
-#  the DNS. You may specify partial addresses (ie 163.85. for everything
-#  behind the usual firewall setup, etc)...
+# You can specify specific IP addresses that should NOT be looked up in DNS.
 # This option is used only if DNSLookup=1.
 # Note: Use space between each value.
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "163.85. 201.101.51.2"
+# Example: "123.123.123.123 REGEX[^192\.168\.]"
 # Default: ""
 #
 SkipDNSLookupFor=""
@@ -388,11 +388,10 @@ DefaultFile="index.html"
 # criteria, else enter ip address criteria.
 # The opposite parameter of "SkipHosts" is "OnlyHosts".
 # Note: Use space between each value.
-# Note: ^xxx means hosts starting with xxx
-# Note: xxx$ means hosts ending with xxx
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "^127.0.0.1$ ^192.168. ^10.0."
-# Example: "localhost abcxyz"
+# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.0\.]"
+# Example: "localhost REGEX[^.*\.localdomain$]"
 # Default: ""
 #
 SkipHosts=""
@@ -402,8 +401,9 @@ SkipHosts=""
 # criteria. If you want to exclude a robot, you should update the robots.pm
 # file instead of this parameter.
 # Note: Use space between each value. This parameter is not case sensitive.
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "konqueror"
+# Example: "konqueror REGEX[ua_test_v\d\.\d]"
 # Default: ""
 #
 SkipUserAgents=""
@@ -413,32 +413,30 @@ SkipUserAgents=""
 # You can, with this option, add a list of not important frame pages (like 
 # menus, etc...) to exclude them from statistics.
 # For example, to ignore a whole directory tree, just add "directorytoignore",
-# to ignore "users" pages in your stats, you can add "/~".
+# to ignore "users" web site pages in your stats, you can add "/~".
 # The opposite parameter of "SkipFiles" is "OnlyFiles".
 # Note: This parameter is not case sensitive.
 # Note: Use space between each value and do not remove default values.
-# Note: ^xxx means url starting with xxx.
-# Note: xxx$ means url ending with xxx.
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "robots.txt$ favicon.ico$ badpage.html$ /~"
-# Default: "robots.txt$ favicon.ico$"
+# Example: "REGEX[robots\.txt$] REGEX[favicon\.ico$] /badpage.html /~"
+# Default: "REGEX[robots\.txt$] REGEX[favicon\.ico$]"
 #
-SkipFiles="robots.txt$ favicon.ico$"
+SkipFiles="REGEX[robots\.txt$] REGEX[favicon\.ico$]"
 
 
 # Include in stats, only accesses from hosts that match one of following
 # entries. For example, if you want AWStats to filter access to keep only
-# stats for visits from particular hosts, you can add thoose hosts names
-# in this parameter.
+# stats for visits from particular hosts, you can add those hosts names in
+# this parameter.
 # If DNS lookup is already done in your log file, you must enter here hostname
 # criteria, else enter ip address criteria.
 # The opposite parameter of "OnlyHosts" is "SkipHosts".
 # Note: This parameter is not case sensitive.
 # Note: Use space between each value.
-# Note: ^xxx means hosts starting with xxx.
-# Note: xxx$ means hosts ending with xxx.
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "^123.123.123.123$ ^10.0."
+# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.0\.]"
 # Default: ""
 #
 OnlyHosts=""
@@ -451,10 +449,9 @@ OnlyHosts=""
 # The opposite parameter of "OnlyFiles" is "SkipFiles".
 # Note: This parameter is not case sensitive.
 # Note: Use space between each value and do not remove default values
-# Note: ^xxx means url starting with xxx.
-# Note: xxx$ means url ending with xxx.
+# Note: You can use regular expression values writing value with REGEX[value].
 # Change : Effective for new updates only
-# Example: "marketing_directory"
+# Example: "marketing_directory REGEX[office\/.*\.(csv|sxw)$]"
 # Default: ""
 #
 OnlyFiles=""
index 25fa763a9ff4eb6bb8d4a803368f3411bfa123d3..4043bbadeb4d8a822e39066d6cf13dd83e7ae10c 100644 (file)
@@ -34,7 +34,7 @@ $DEBUGFORCED=0;                                               # Force debug level to log lesser level into debug.log file
 $NBOFLINESFORBENCHMARK=8192;           # Benchmark info are printing every NBOFLINESFORBENCHMARK lines (Must be a power of 2)
 $FRAMEWIDTH=260;                                       # Width of left frame when UseFramesWhenCGI is on
 $NBOFLASTUPDATELOOKUPTOSAVE=200;       # Nb of records to save in DNS last update cache file
-$LIMITFLUSH=4000;                                      # Nb of records in data arrays after how we need to flush data on disk
+$LIMITFLUSH=5000;                                      # Nb of records in data arrays after how we need to flush data on disk
 $NEWDAYVISITTIMEOUT=764041;                    # Delay between 01-23:59:59 and 02-00:00:00
 $VISITTIMEOUT=10000;                           # Laps of time to consider a page load as a new visit. 10000 = 1 hour (Default = 10000)
 $NOTSORTEDRECORDTOLERANCE=10000;       # Laps of time to accept a record if not in correct order. 10000 = 1 hour (Default = 10000)
@@ -1108,7 +1108,7 @@ sub Parse_Config {
                        }
                if ($param =~ /^HostAliases/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @HostAliases,$elem; }
                        }
                        next;
@@ -1116,7 +1116,7 @@ sub Parse_Config {
                # Special optional setup params
                if ($param =~ /^SkipDNSLookupFor/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @SkipDNSLookupFor,$elem; }
                        }
                        next;
@@ -1126,43 +1126,43 @@ sub Parse_Config {
                        next;
                        }
                if ($param =~ /^DefaultFile/)           {
-                       foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                       foreach my $elem (split(/\s+/,$value))  {       # No REGEX for this option
+                               $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./;      # Replace . into \.
                                if ($elem) { push @DefaultFile,$elem; }
                        }
                        next;
                        }
                if ($param =~ /^SkipHosts/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @SkipHosts,$elem; }
                        }
                        next;
                        }
                if ($param =~ /^SkipUserAgents/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @SkipUserAgents,$elem; }
                        }
                        next;
                        }
                if ($param =~ /^SkipFiles/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @SkipFiles,$elem; }
                        }
                        next;
                        }
                if ($param =~ /^OnlyHosts/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @OnlyHosts,$elem; }
                        }
                        next;
                        }
                if ($param =~ /^OnlyFiles/) {
                        foreach my $elem (split(/\s+/,$value))  {
-                               if ($elem!~s/^REGEX://i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; } # Replace . into \.
+                               if ($elem!~s/^REGEX\[(.*)\]$/$1/i) { $elem =~ s/\\\./\./g; $elem =~ s/([^\\])\./$1\\\./g; $elem =~ s/^\./\\\./; }       # Replace . into \.
                                if ($elem) { push @OnlyFiles,$elem; }
                        }
                        next;
@@ -5733,7 +5733,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') {  # Updat
                                                }
                                                else {
                                                        foreach my $key (@HostAliases) {
-                                                               if ($refererserver =~ /^$key$/i) {
+                                                               if ($refererserver =~ /$key/i) {
                                                                        # Intern (This hit came from another page of the site)
                                                                        if ($Debug) { debug("  Server '$refererserver' is added to TmpRefererServer with value '='",2); }
                                                                        $TmpRefererServer{$refererserver}='=';
@@ -6059,9 +6059,9 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') {  # Updat
 if (scalar keys %HTMLOutput) {
 
        my $max_p; my $max_h; my $max_k; my $max_v;
-       my $total_u; my $total_v; my $total_p; my $total_h; my $total_k; my $total_e; my $total_x; my $total_s;
+       my $total_u; my $total_v; my $total_p; my $total_h; my $total_k; my $total_e; my $total_x; my $total_s; my $total_l;
        my $average_u; my $average_v; my $average_p; my $average_h; my $average_k; my $average_s;
-       my $rest_p; my $rest_h; my $rest_k; my $rest_e; my $rest_x; my $rest_s;
+       my $rest_p; my $rest_h; my $rest_k; my $rest_e; my $rest_x; my $rest_s; my $rest_l;
        my $average_nb;
 
        # Define the NewLinkParams for main chart
@@ -7106,13 +7106,23 @@ if (scalar keys %HTMLOutput) {
                my $title="$Message[46]";
                &tab_head("$title",19);
                print "<TR bgcolor=\"#$color_TableBGRowTitle\"><TH>User agent (".(scalar keys %_unknownreferer_l).")</TH><TH>$Message[9]</TH></TR>\n";
+               $total_l=0;
                my $count=0;
                &BuildKeyList($MaxRowsInHTMLOutput,1,\%_unknownreferer_l,\%_unknownreferer_l);
                foreach my $key (@keylist) {
                        my $useragent=CleanFromCSSA($key);
-                       print "<tr><td CLASS=AWL>$useragent</td><td>".Format_Date($_unknownreferer_l{$key},1)."</td></tr>\n";
+                       print "<tr><td CLASS=AWL>$useragent</td>";
+                       print "<td>".Format_Date($_unknownreferer_l{$key},1)."</td>";
+                       print "</tr>\n";
+                       $total_l+=1;
                        $count++;
                }
+               $rest_l=(scalar keys %_unknownreferer_l)-$total_l;
+               if ($rest_l > 0) {
+                       print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[2]</font></TD>";
+                       print "<TD>-</TD>";
+                       print "</TR>\n";
+               }
                &tab_end;
                &html_end;
        }
@@ -7121,13 +7131,21 @@ if (scalar keys %HTMLOutput) {
                my $title="$Message[50]";
                &tab_head("$title",19);
                print "<TR bgcolor=\"#$color_TableBGRowTitle\"><TH>User agent (".(scalar keys %_unknownrefererbrowser_l).")</TH><TH>$Message[9]</TH></TR>\n";
+               $total_l=0;
                my $count=0;
                &BuildKeyList($MaxRowsInHTMLOutput,1,\%_unknownrefererbrowser_l,\%_unknownrefererbrowser_l);
                foreach my $key (@keylist) {
                        my $useragent=CleanFromCSSA($key);
                        print "<tr><td CLASS=AWL>$useragent</td><td>".Format_Date($_unknownrefererbrowser_l{$key},1)."</td></tr>\n";
+                       $total_l+=1;
                        $count++;
                }
+               $rest_l=(scalar keys %_unknownrefererbrowser_l)-$total_l;
+               if ($rest_l > 0) {
+                       print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[2]</font></TD>";
+                       print "<TD>-</TD>";
+                       print "</TR>\n";
+               }
                &tab_end;
                &html_end;
        }
@@ -7329,7 +7347,7 @@ if (scalar keys %HTMLOutput) {
                        if ($TotalSearchEnginesHits) { $p_h=int($rest_h/$TotalSearchEnginesHits*1000)/10; }
                        print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[2]</font></TD>";
                        print "<TD>".($rest_p?$rest_p:'&nbsp;')."</TD>";
-                       print "<TD>".($rest_p?"%p_p %":'&nbsp;')."</TD>";
+                       print "<TD>".($rest_p?"$p_p %":'&nbsp;')."</TD>";
                        print "<TD>$rest_h</TD>";
                        print "<TD>$p_h %</TD>";
                        print "</TR>\n";