If you are using Logstash and need to enrich event data with geolocation information based on IP addresses, the following filter configuration can help.
The filter checks if the IP belongs to private/internal network ranges and skips geolocation enrichment for internal IPs to optimize processing.
If the IP is external, the configuration applies the geoip filter to enrich the event with geolocation information.
This setup improves Logstash performance and ensures accurate geolocation enrichment for Elasticsearch logs.