diff --git a/pkg/leakybucket/manager.go b/pkg/leakybucket/manager.go index c73eab128..6ae9e1894 100644 --- a/pkg/leakybucket/manager.go +++ b/pkg/leakybucket/manager.go @@ -195,8 +195,11 @@ func LoadBucketDir(dir string, dataFolder string) ([]BucketFactory, chan types.E func LoadBucket(g *BucketFactory, dataFolder string) error { var err error if g.Debug { - var clog = log.New() - clog.SetFormatter(&log.TextFormatter{FullTimestamp: true}) + var clog = logrus.New() + if types.ConfigureLogger(clog) != err { + log.Fatalf("While creating bucket-specific logger : %s", err) + } + me clog.SetLevel(log.DebugLevel) g.logger = clog.WithFields(log.Fields{ "cfg": g.BucketName, diff --git a/pkg/parser/node.go b/pkg/parser/node.go index 2411b76f6..481b2fe65 100644 --- a/pkg/parser/node.go +++ b/pkg/parser/node.go @@ -253,10 +253,15 @@ func (n *Node) process(p *types.Event, ctx UnixParserCtx) (bool, error) { //return false, nil } } - + var groklabel string + if n.Grok.RegexpName == "" { + groklabel = fmt.Sprintf("%5.5s...", n.Grok.RegexpValue) + } else { + groklabel = n.Grok.RegexpName + } grok := n.Grok.RunTimeRegexp.Parse(gstr) if len(grok) > 0 { - clog.Debugf("+ Grok '%s' returned %d entries to merge in Parsed", n.Grok.RegexpName, len(grok)) + clog.Debugf("+ Grok '%s' returned %d entries to merge in Parsed", groklabel, len(grok)) //We managed to grok stuff, merged into parse for k, v := range grok { clog.Debugf("\t.Parsed['%s'] = '%s'", k, v) @@ -269,7 +274,7 @@ func (n *Node) process(p *types.Event, ctx UnixParserCtx) (bool, error) { } } else { //grok failed, node failed - clog.Debugf("+ Grok '%s' didn't return data on '%s'", n.Grok.RegexpName, gstr) + clog.Debugf("+ Grok '%s' didn't return data on '%s'", groklabel, gstr) //clog.Tracef("on '%s'", gstr) NodeState = false } @@ -337,6 +342,9 @@ func (n *Node) compile(pctx *UnixParserCtx) error { that will be used only for processing this node ;) */ if n.Debug { var clog = logrus.New() + if types.ConfigureLogger(clog) != err { + log.Fatalf("While creating bucket-specific logger : %s", err) + } clog.SetLevel(log.DebugLevel) n.logger = clog.WithFields(log.Fields{ "id": n.rn, @@ -412,6 +420,9 @@ func (n *Node) compile(pctx *UnixParserCtx) error { /* compile leafs if present */ if len(n.SuccessNodes) > 0 { for idx := range n.SuccessNodes { + if n.SuccessNodes[idx].Name == "" { + n.SuccessNodes[idx].Name = fmt.Sprintf("child-%s", n.Name) + } /*propagate debug/stats to child nodes*/ if !n.SuccessNodes[idx].Debug && n.Debug { n.SuccessNodes[idx].Debug = true