Sentry can use MaxMind's free
GeoLite2-City database to geolocate IP addresses, providing additional context for error events where the end user's IP address is known and for the session history of users logging into your Sentry installation. We bundle MaxMind's
geoipupdate tool for this purpose. To enable IP address geolocation, sign up for a free MaxMind account, then tell Sentry about your credentials by placing your MaxMind configuration file at
AccountID 012345 LicenseKey foobarbazbuz EditionIDs GeoLite2-City
With this configuration file in place, subsequent runs of Sentry's
install.sh will refresh the IP address geolocation database. The next time you restart your self-hosted Sentry instance (the
web services, in particular), you should start seeing the latest data. Here's how to confirm that it's working:
relayservice: Dashboards > Errors by Country should have some purple on it.
webservice: User Settings > Security > Session History should display country code and region (for example, "US (CA)") underneath the IP addresses in the table.
The services that consume the
GeoLite2-City.mmdb file need to know where to find it. New installs will have this set automatically, but if you are upgrading you will need to manually set the following before restarting Sentry.
processing: geoip_path: "/geoip/GeoLite2-City.mmdb"
GEOIP_PATH_MMDB = '/geoip/GeoLite2-City.mmdb'