GeoIP2 Filter allows you to enrich the incoming data stream using location data from GeoIP2 database.
This plugin supports the following configuration parameters:
Key | Description |
database | Path to the GeoIP2 database. |
lookup_key | Field name to process |
record | Defines the |
The following configuration will process incoming remote_addr
, and append country information retrieved from GeoLite2 database.
[INPUT]Name dummyDummy {"remote_addr": "8.8.8.8"}​[FILTER]Name geoip2Match *Database GeoLite2-City.mmdbLookup_key remote_addrRecord country remote_addr %{country.names.en}Record isocode remote_addr %{country.iso_code}​[OUTPUT]Name stdoutMatch *
Each Record
parameter above specifies the following triplet:
The field name to be added to records (country
)
The lookup key to process (remote_addr
)
The query for GeoIP2 database (%{country.names.en}
)
By running Fluent Bit with the configuration above, you will see the following output:
{"remote_addr": "8.8.8.8", "country": "United States", "isocode": "US"}
Note that the GeoLite2-City.mmdb
database is available from MaxMind's official site.