From 2c61fad895db596a0628c00e80b5387c24fc00ed Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Wed, 23 Dec 2020 16:12:41 +0100 Subject: [PATCH] improve the error log message for snmp trap (#8552) add OID value and source information into error log and make it easier for troubleshooting --- plugins/inputs/snmp_trap/snmp_trap.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index d380d582bad66..e14d129e84f1b 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -284,7 +284,7 @@ func makeTrapHandler(s *SnmpTrap) handler { if trapOid != "" { e, err := s.lookup(trapOid) if err != nil { - s.Log.Errorf("Error resolving V1 OID: %v", err) + s.Log.Errorf("Error resolving V1 OID, oid=%s, source=%s: %v", trapOid, tags["source"], err) return } setTrapOid(tags, trapOid, e) @@ -322,7 +322,7 @@ func makeTrapHandler(s *SnmpTrap) handler { var err error e, err = s.lookup(val) if nil != err { - s.Log.Errorf("Error resolving value OID: %v", err) + s.Log.Errorf("Error resolving value OID, oid=%s, source=%s: %v", val, tags["source"], err) return } @@ -340,7 +340,7 @@ func makeTrapHandler(s *SnmpTrap) handler { e, err := s.lookup(v.Name) if nil != err { - s.Log.Errorf("Error resolving OID: %v", err) + s.Log.Errorf("Error resolving OID oid=%s, source=%s: %v", v.Name, tags["source"], err) return }