Explorar o código

Add method name to child logger so we can see which function is erroring when in enrichers (#2411)

Laurence Jones hai 1 ano
pai
achega
0334a9afe8
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      pkg/parser/runtime.go

+ 1 - 1
pkg/parser/runtime.go

@@ -152,7 +152,7 @@ func (n *Node) ProcessStatics(statics []ExtraField, event *types.Event) error {
 			/*still way too hackish, but : inject all the results in enriched, and */
 			/*still way too hackish, but : inject all the results in enriched, and */
 			if enricherPlugin, ok := n.EnrichFunctions.Registered[static.Method]; ok {
 			if enricherPlugin, ok := n.EnrichFunctions.Registered[static.Method]; ok {
 				clog.Tracef("Found method '%s'", static.Method)
 				clog.Tracef("Found method '%s'", static.Method)
-				ret, err := enricherPlugin.EnrichFunc(value, event, enricherPlugin.Ctx, n.Logger)
+				ret, err := enricherPlugin.EnrichFunc(value, event, enricherPlugin.Ctx, n.Logger.WithField("method", static.Method))
 				if err != nil {
 				if err != nil {
 					clog.Errorf("method '%s' returned an error : %v", static.Method, err)
 					clog.Errorf("method '%s' returned an error : %v", static.Method, err)
 				}
 				}