Geolocation

From Wikitech
Jump to navigation Jump to search

Geolocation is based on the MaxMind GeoIP2 database paid for by the WMF, and is used in two ways:

  • Varnish adds a cookie called GeoIP (only if the request does not already have one), with lifetime set to the current session, in the format <ISO 3166-1 country code>:<ISO 3166-2 region code>:<city name>:<lat>:<long>:<???>
  • The analytics pipeline adds geolocation data to the geocoded_data field of the webrequest table, based on the IP address.

To look up data by hand, log in to mwlog1001 or mwmaint1002 and run mmdblookup --file /usr/share/GeoIP/GeoIP2-City.mmdb --ip <IP> (see here for documentation of the returned data structure) or, if you just want a single field, something like mmdblookup --file /usr/share/GeoIP/GeoIP2-City.mmdb --ip <IP> country names en.

The information below is probably outdated.


As usual, geolocation being a fundraising-related thing (first introduced in 2009), there's only mystery around it. Here's some sparse links: