GeoIP Transform
The Vector geoip transform accepts log events and allows you to enrich events with geolocation data from the MaxMind GeoIP2 and GeoLite2 city databases.
Configuration
[transforms.my_transform_id]# REQUIREDtype = "geoip" # example, must be: "geoip"inputs = ["my-source-id"] # exampledatabase = "/path/to/GeoLite2-City.mmdb" # examplesource = "ip_address" # example# OPTIONALtarget = "geoip" # default
Options
database
Path to the MaxMind GeoIP2 or GeoLite2 binary city database file (GeoLite2-City.mmdb). Other databases, such as the the country database are not supported.
source
The field name that contains the IP address. This field should contain a valid IPv4 or IPv6 address.
target
The default field to insert the resulting GeoIP data into. See output for more info.
"geoip"Output
The geoip transform accepts log events and allows you to enrich events with geolocation data from the MaxMind GeoIP2 and GeoLite2 city databases.
For example:
{"geoip": {"city_name": "New York","continent_code": ["AF","Africa"],"country_code": "US","latitude": "51.75","longitude": "-1.25","postal_code": "07094","timezone": "America/New_York"}}
More detail on the output schema is below.
geoip
The root field containing all geolocation data as sub-fields.
city_name
The city name associated with the IP address.
continent_code
The continent code associated with the IP address.
"AF" "AN" "AS" "EU" "NA" "OC" "SA" country_code
The ISO 3166-2 country codes associated with the IP address.
latitude
The latitude associated with the IP address.
longitude
The longitude associated with the IP address.
postal_code
The postal code associated with the IP address.
timezone
The timezone associated with the IP address in IANA time zone format. A full list of time zones can be found here.
How It Works
Environment Variables
Environment variables are supported through all of Vector's configuration.
Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable
will be replaced before being evaluated.
You can learn more in the Environment Variables section.