9 my $gi = Geo::IP->open("/usr/share/GeoIP/GeoIP.dat", GEOIP_MEMORY_CACHE);
 
  10 my $total_bandwidth = 560 * 1024 * 1024;
 
  14 while (my $record = <>)
 
  16     if ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_[A-Z_]+\/\d+\s+(\d+) (?:GET|HEAD|POST|OPTIONS|PROPFIND) /)
 
  20         my $country = $gi->country_code_by_addr($ip);
 
  22         if (defined($country) &&
 
  23             $country ne "A1" && $country ne "A2" && 
 
  24             $country ne "01" && $country ne "--")
 
  26             $country_bytes{$country} += $bytes;
 
  29         $total_bytes += $bytes;
 
  31     elsif ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+TCP_DENIED\/\d+\s+(\d+) /)
 
  35     elsif ($record =~ /^\d+\.\d+\s+\d+\s+(\d+\.\d+\.\d+\.\d+)\s+UDP_[A-Z_]+\/\d+\s+(\d+) ICP_QUERY /)
 
  45 my %country_bandwidth;
 
  47 while (my($country,$bytes) = each %country_bytes)
 
  49     $country_bandwidth{$country} = $bytes * $total_bandwidth / $total_bytes;
 
  52 print Dump(\%country_bandwidth);