Configure GeoIP Database Management
To configure GeoIP Database Management:
Verify that you are using a license that includes the geoip database management feature.
For more information, see https://www.elastic.co/subscriptions and License management.
Specify geoip database management settings in the
logstash.ymlfile to tune the configuration as-needed.
You can set the following xpack.geoip settings in logstash.yml to configure the geoip database manager. For more information about configuring Logstash, see logstash.yml.
xpack.geoip.downloader.enabled- (Boolean) If
true, Logstash automatically downloads and manages updates for GeoIP2 databases from thexpack.geoip.downloader.endpoint. Iffalse, Logstash does not manage GeoIP2 databases and plugins that need a GeoIP2 database must be configured to provide their own. xpack.geoip.downloader.endpoint- (String) Endpoint URL used to download updates for GeoIP2 databases. For example,
https://example.com/overview.json. Defaults tohttps://geoip.elastic.co/v1/database. Note that Logstash will periodically make a GET request to${xpack.geoip.downloader.endpoint}?elastic_geoip_service_tos=agree, expecting the list of metadata about databases typically found inoverview.json. xpack.geoip.downloader.poll.interval- (Time Value) How often Logstash checks for GeoIP2 database updates at the
xpack.geoip.downloader.endpoint. For example,6hto check every six hours. Defaults to24h(24 hours).
If Logstash does not have access to the internet, or if you want to disable the database manager, set the xpack.geoip.downloader.enabled value to false in logstash.yml. When the database manager is disabled, plugins that require GeoIP lookups must be configured with their own source of GeoIP databases.
If you can’t connect directly to the Elastic GeoIP endpoint, consider setting up an HTTP proxy server. You can then specify the proxy with http_proxy environment variable.
export http_proxy="http://PROXY_IP:PROXY_PORT"
If you work in an air-gapped environment and can’t update your databases from the Elastic endpoint, You can then download databases from MaxMind and bootstrap the service.
Download both
GeoLite2-ASN.mmdbandGeoLite2-City.mmdbdatabase files from the MaxMind site.Copy both database files to a single directory.
From your Elasticsearch directory, run:
./bin/elasticsearch-geoip -s my/database/dirServe the static database files from your directory. For example, you can use Docker to serve the files from nginx server:
docker run -p 8080:80 -v my/database/dir:/usr/share/nginx/html:ro nginxSpecify the service’s endpoint URL in Logstash using the
xpack.geoip.download.endpoint=http://localhost:8080/overview.jsonsetting inlogstash.yml.
Logstash gets automatic updates from this service.