Repository navigation
Description
Description:
We propose adding an geoip function to OpenSearch's Piped Processing Language (PPL) and SQL to provide built-in IP address geolocation capabilities.
This feature would be similar to functionality used in OpenSearch's geospatial feature, enhancing PPL's ability to enrich log data with geographical information based on IP addresses.
Proposed Functionality:
- The 'geoip' function should take an IP address as input and return geographical information.
- It should support both IPv4 and IPv6 addresses.
- The function should return multiple fields including country, region, city, latitude, longitude, and others as available.
- It should allow users to specify which geolocation fields to include in the output.
- The function should use a regularly updated IP geolocation database for accuracy.
Example Usage:
... | eval geolocation = geoip(ip_field)This would add a new field 'geolocation' with all available location information for the IP address in 'ip_field'.
... | eval country = geoip(ip_field, "country")
... | eval lat = geoip(ip_field, "lat"), lon = iplocation(ip_field, "lon")This would add new fields with specific geolocation information.
... | eval location_info = geoip(ip_field, "country,region,city,lat,lon")This would add a new field 'location_info' with multiple pieces of geolocation data.
Additional considerations
- Allow for registering a DB table that allows resolving the IP to Geo
- Adding a generic way to register the IP to Geo location resolving mechanism / service
- Adding auth tokens for calling such service
Support for PPL iplocation function is required for both:
OpenSearch based PPL engine
Spark based PPL engine
Related resources
Activity
dblock commentedon Oct 7, 2024
[Catch All Triage - 1, 2, 3, 4]
andy-k-improving commentedon Dec 23, 2024
For the community awareness, I'm working on this.
andy-k-improving commentedon Jan 10, 2025
To provide some status update here, following are the planned items, in order to achieve this IPEnrichment funcationality via. Geo-Staptial plugin:
geospatial-clientfor cross-plugin IP enrichment geospatial#700geoipcommand on this project: PPL command expression implementation forgeoip#3228Which the first two items are completed and I'm working on the actual
geoipon SQL repo.andy-k-improving commentedon Jan 21, 2025
@YANG-DB The actual implementation is yet to be merged, we will need to re-open this.
#3228