Skip to content

GeoIp Processor

Ral G edited this page Jan 23, 2022 · 16 revisions

Geo IP [geoIp]

Downloading mmdb

You can supply maxMindGeoIpCityUrl property during the Maven / Gradle build to fetch and automatically package Max Mind geo ip database within the jar and use GeoLite2-City.tar.gz name to pass to GeoIpConfiguration.

GeoIpConfiguration

To use the GeoIP processor, users are required to download the MaxMind database from https://dev.maxmind.com/geoip/geoip2/geolite2/ and configure the GeoIpProcessor with the location of the downloaded file. That is done by providing a new GeoIpConfiguration("<path_to_mmdb>") to the Pipeline.Factory constructor. Pipeline creation will fail if the file is missing or invalid. If no GeoIpConfiguration was provided an exception will be thrown only during an attempt to create a GeoIpProcessor.

Example

String mmdbFilePath = "Geo2Lite-city.mmdb";
GeoIpConfiguration geoIpConfiguration = new GeoIpConfiguration(mmdbFilePath);
Pipeline.Factory factory = new Pipeline.Factory(geoIpConfiguration);

GeoIpProcessor

This processor enriches the document with geoIp data based on the Max Mind geoIp database.

  • sourceField
  • targetField
  • tagsOnSuccess [array] (optional)

Example

{
  "steps": [
    {
      "geoIp": {
        "config": {
          "sourceField": "ip",
          "targetField": "geoip",
          "tagsOnSuccess": [
            "geo-ip"
          ]
        }
      }
    }
  ]
}
Clone this wiki locally