]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Update awstats.pl 31/head
authorbcogit <b.collin@immanens.com>
Tue, 21 Jun 2016 14:51:19 +0000 (16:51 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Jun 2016 14:51:19 +0000 (16:51 +0200)
I have log (from AWS load balancer) that have an ip syntaxe with port (ex: 54.32.12.1:60321)

The change is only to cut the port and only keep the ip, so the geoip tools could work correctly then.

I'm not a perl expert, but it work on my installation with my data.

wwwroot/cgi-bin/awstats.pl

index bf7fadcd2243f8f95266fd1ace4c7403809ddde7..f7dfa4ad7032b6c4e937518b412bd819538959b8 100755 (executable)
@@ -19200,6 +19200,11 @@ if ( $UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft' )
                my $HostResolved = ''
                  ; # HostResolved will be defined in next paragraf if countedtraffic is true
 
+               if( $Host =~ /^([^:]+):[0-9]+$/ ){ # Host may sometimes have an ip:port syntax (ex: 54.32.12.12:60321)
+                   $Host = $1;
+               }
+
+
                if ( !$countedtraffic || $countedtraffic == 6) {
                        my $ip = 0;
                        if ($DNSLookup) {    # DNS lookup is 1 or 2