]> git.openstreetmap.org Git - dns.git/blobdiff - bin/sumlogs
Switch the tile CDN to use a TLSv1.3 enabled map
[dns.git] / bin / sumlogs
index c46bcbaed4ede083dd458f36eb34258122d72a16..7096bded346239d7d7bc9486490408783637ded6 100755 (executable)
@@ -7,12 +7,13 @@ use Geo::IP;
 use YAML;
 
 my $gi = Geo::IP->open("/usr/share/GeoIP/GeoIP.dat", GEOIP_MEMORY_CACHE);
+my $total_bandwidth = 560 * 1024 * 1024;
 my $total_bytes = 0;
 my %country_bytes;
 
 while (my $record = <>)
 {
-    if ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_[A-Z_]+\/\d+\s+(\d+) (?:GET|HEAD|POST|OPTIONS|PROPFIND) /)
+    if ($record =~ /^\d+\.\d+\s+\S+\s+".*"\s+(\d+\.\d+\.\d+\.\d+)\s+".*"\s+(\d+)$/)
     {
         my $ip = $1;
         my $bytes = $2;
@@ -27,14 +28,6 @@ while (my $record = <>)
 
         $total_bytes += $bytes;
     }
-    elsif ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_DENIED\/\d+\s+(\d+) /)
-    {
-       # do nothing
-    }
-    elsif ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+UDP_[A-Z_]+\/\d+\s+(\d+) ICP_QUERY /)
-    {
-       # do nothing
-    }
     else
     {
         warn $record;
@@ -45,7 +38,7 @@ my %country_bandwidth;
 
 while (my($country,$bytes) = each %country_bytes)
 {
-    $country_bandwidth{$country} = $bytes * 300 * 1024 * 1024 / $total_bytes;
+    $country_bandwidth{$country} = $bytes * $total_bandwidth / $total_bytes;
 }
 
 print Dump(\%country_bandwidth);