]> git.openstreetmap.org Git - dns.git/blobdiff - bin/sumlogs
Update mkgeo to use LWP::UserAgent::Determined + set fair timeout
[dns.git] / bin / sumlogs
index 0db3ac6fb24f08471595f99e1f38238d3605af93..400a3631ca724753cf5e65469c21fe38b99406b1 100755 (executable)
@@ -8,7 +8,7 @@ use YAML;
 
 my $pt = new Net::Patricia;
 
 
 my $pt = new Net::Patricia;
 
-open(COUNTRIES, "< /etc/powerdns/countries.conf") || die "Can't open /etc/powerdns/countries.conf";
+open(COUNTRIES, "< countries.conf") || die "Can't open /etc/powerdns/countries.conf";
 
 while (my $line = <COUNTRIES>)
 {
 
 while (my $line = <COUNTRIES>)
 {
@@ -28,7 +28,7 @@ my %country_bytes;
 
 while (my $record = <>)
 {
 
 while (my $record = <>)
 {
-    if ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_[A-Z_]+\/\d+\s+(\d+) /)
+    if ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_[A-Z_]+\/\d+\s+(\d+) (?:GET|HEAD|POST) /)
     {
         my $ip = $1;
         my $bytes = $2;
     {
         my $ip = $1;
         my $bytes = $2;
@@ -38,6 +38,10 @@ while (my $record = <>)
 
         $total_bytes += $bytes;
     }
 
         $total_bytes += $bytes;
     }
+    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;
     else
     {
         warn $record;
@@ -48,7 +52,7 @@ my %country_bandwidth;
 
 while (my($country,$bytes) = each %country_bytes)
 {
 
 while (my($country,$bytes) = each %country_bytes)
 {
-    $country_bandwidth{$country} = $bytes * 250 * 1024 * 1024 / $total_bytes;
+    $country_bandwidth{$country} = $bytes * 300 * 1024 * 1024 / $total_bytes;
 }
 
 print Dump(\%country_bandwidth);
 }
 
 print Dump(\%country_bandwidth);