<filter access.apache>
@type geoip
# Specify one or more geoip lookup field which has ip address (default: host)
geoip_lookup_keys host
# Specify optional geoip database (using bundled GeoLiteCity database by default)
# geoip_database "/path/to/your/GeoIPCity.dat"
# Specify optional geoip2 database (using bundled GeoLite2 database by default)
# geoip2_database "/path/to/your/GeoLite2-City.mmdb"
# Specify backend library (geoip2_c, geoip, geoip2_compat)
backend_library geoip2_c
# Set adding field with placeholder (more than one settings are required.)
<record>
city ${city.names.en["host"]}
latitude ${location.latitude["host"]}
longitude ${location.longitude["host"]}
country ${country.iso_code["host"]}
country_name ${country.names.en["host"]}
postal_code ${postal.code["host"]}
region_code ${subdivisions.0.iso_code["host"]}
region_name ${subdivisions.0.names.en["host"]}
</record>
# To avoid get stacktrace error with `[null, null]` array for elasticsearch.
skip_adding_null_record true
</filter>
<filter apache.access>
@type geoip
backend_library geoip2_c
# Set key name for the client ip address values
geoip_lookup_keys host
# Specify key name for the country_code values
<record>
country_code ${country.iso_code["host"]}
country_name ${country.names.en["host"]}
</record>
</filter>
<match apache.access>
@type elasticsearch
host localhost
port 9200
type_name apache
logstash_format true
flush_interval 10s
</match>