GeoIP
Synopsis
Enriches IP addresses with geographical and network information using MaxMind's GeoIP2 databases.
The processor supports both IPv4 and IPv6 addresses and can extract various location attributes including continent, country, city, coordinates, and autonomous system information.
Schema
geoip:
- field: <ident>
- database_file: <string>
- description: <text>
- first_only: <boolean>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- properties: <string[]>
- tag: <string>
- target_field: <ident>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing the IP address to lookup |
database_file | N | GeoLite2-City.mmdb | GeoIP database file to use. Supports City, Country and ASN databases |
description | N | - | Documentation note |
first_only | N | true | Process only first IP if multiple found |
if | N | - | Conditional expression |
ignore_failure | N | false | Skip processing errors |
ignore_missing | N | false | Skip if input field missing |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
properties | N | all | Properties to extract (see Properties section) |
tag | N | - | Identifier for logging |
target_field | N | geo/as | Output field for location data |
Details
The processor can extract different properties depending on the database type used:
-
City/Country databases
continent_name
English name of the continentcountry_name
English name of the countrycountry_iso_code
Two-letter country coderegion_name
English name of the region/stateregion_iso_code
Region/state codecity_name
English name of the citylocation
Object containing latitude and longitude -
ASN databases
asn
Autonomous System Numberorganization_name
Organization operating the AS
The processor supports three types of MaxMind databases:
-
City Database (
GeoLite2-City.mmdb
) - Most detailed information. Includes all location properties, and default database if none specified -
Country Database (
GeoLite2-Country.mmdb
) - Country-level information only. Lighter weight than city database, although no city or region information -
ASN Database (
GeoLite2-ASN.mmdb
) - Network information only. Provides AS number and organization, although without location information
The GeoIP database files must be placed in the service's database directory or specified with absolute paths.
The processor caches database handles for performance. Ensure sufficient memory is available when using large databases.
Examples
Basic
Looking up IP address location... |
|
adds geographic information: |
|
ASN
Looking up network information... |
|
adds network details: |
|
Full Location
Extracting all location information... |
|
provides comprehensive details: |
|
Error Handling
Handling invalid IPs gracefully... |
|
captures the error information: |
|