diff --git a/pkg/parser/enrich_geoip.go b/pkg/parser/enrich_geoip.go index 58732129af8..1756927bc4b 100644 --- a/pkg/parser/enrich_geoip.go +++ b/pkg/parser/enrich_geoip.go @@ -25,7 +25,7 @@ func IpToRange(field string, p *types.Event, plog *log.Entry) (map[string]string } if r == nil { - plog.Warnf("No range found for ip '%s'", field) + plog.Debugf("No range found for ip '%s'", field) return nil, nil } @@ -49,10 +49,15 @@ func GeoIpASN(field string, p *types.Event, plog *log.Entry) (map[string]string, r, err := exprhelpers.GeoIPASNEnrich(field) if err != nil { - plog.Errorf("Unable to enrich ip '%s'", field) + plog.Debugf("Unable to enrich ip '%s'", field) return nil, nil //nolint:nilerr } + if r == nil { + plog.Debugf("No ASN found for ip '%s'", field) + return nil, nil + } + record, ok := r.(*geoip2.ASN) if !ok { @@ -78,10 +83,15 @@ func GeoIpCity(field string, p *types.Event, plog *log.Entry) (map[string]string r, err := exprhelpers.GeoIPEnrich(field) if err != nil { - plog.Errorf("Unable to enrich ip '%s'", field) + plog.Debugf("Unable to enrich ip '%s'", field) return nil, nil //nolint:nilerr } + if r == nil { + plog.Debugf("No city found for ip '%s'", field) + return nil, nil + } + record, ok := r.(*geoip2.City) if !ok {