Add country region in logs.
    Alex Flex 
    aflexzor at gmail.com
       
    Wed Aug 28 18:03:48 UTC 2013
    
    
  
Hello nginx!
Iam trying to identify all my visitors based on their continent region, 
i want to log this info in each log entry. There is no geoip database 
for continent region so I want to map manually the countries within 
their regions.
I already have the GeoIP db loaded, and an example map for a region as 
follows:
  map $geoip_country_code $north_africa {
         default "";
         ##Northern Africa
         DZ 1; #"Algeria"
         EG 1; #"Egypt"
         EH 1; #"Western Sahara"
         LY 1; #"Libyan Arab Jamahiriya"
         MA 1; #"Morocco"
         SD 1; #"Sudan"
         TN 1; #"Tunisia"
         }
Would anybody kindly offer me an example of how to generate a variable I 
can use in the logging that would print "NorthAfica" if one of the 
countries in the map matched?
Thanks
Alex
    
    
More information about the nginx
mailing list