From 534fb14f7b91d3b098c4ccd214653e5ac058edb4 Mon Sep 17 00:00:00 2001 From: blotus Date: Mon, 19 Aug 2024 10:07:06 +0200 Subject: [PATCH] hide geoip related warnings (#3179) --- pkg/parser/enrich_geoip.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 {