geoip
The filter_geoip
Filter plugin adds geographic location information to logs using the Maxmind GeoIP databases.
This document does not describe all the parameters. If you want to know full features, check the Further Reading section.
Prerequisites
Install GeoIP library:
libmaxminddb
for GeoIP2 is bundled with geoip2_c
.
Install
filter_geoip
is not included in td-agent
. All users must install the fluent-plugin-geoip
gem using the following command:
For more details, see Plugin Management.
Example Configuration
This configuration adds the geolocation information to apache.access
:
See fluent-plugin-geoip README for further details.
Plugin helpers
Parameters
See Common Parameters.
geoip_database
geoip_database
type | default | version |
string | bundled | 1.0.0 |
Path to GeoIP database file.
geoip2_database
geoip2_database
type | default | version |
string | bundled | 1.0.0 |
Path to GeoIP2 database file.
geoip_lookup_keys
geoip_lookup_keys
type | default | version |
array | ["host"] | 1.2.0 |
Specifies one or more geoip lookup fields containing the IP address.
See record_accessor
about nested attributes.
NOTE: Since v1.3.0 does not interpret host.ip
as a nested attribute.
geoip_lookup_key
geoip_lookup_key
type | default | version |
string | host | 1.0.0 |
Specifies one or more geoip lookup fields containing the ip address.
This parameter has been deprecated since v1.2.0.
skip_adding_null_record
skip_adding_null_record
type | default | version |
bool | false | 1.0.0 |
Set to true
to skip adding the field with [null, null]
array.
This is useful for Elasticsearch.
backend_library
backend_library
type | default | available values | version |
enum | geoip2_c | geoip, geoip2_compat, geoip2_c | 1.0.0 |
Set backend library.
Use cases
Plot Realtime Access Statistics on a World Map using Elasticsearch and Kibana
The country_code
field is needed to visualize access statistics on a world map using Kibana.
Required plugins:
fluent-plugin-geoip
fluent-plugin-elasticsearch
Further Reading
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last updated