fix pattern registration (#715)
This commit is contained in:
parent
e59c33a8e2
commit
4166d9ff48
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/antonmedv/expr"
|
"github.com/antonmedv/expr"
|
||||||
|
"github.com/logrusorgru/grokky"
|
||||||
yaml "gopkg.in/yaml.v2"
|
yaml "gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/antonmedv/expr/vm"
|
"github.com/antonmedv/expr/vm"
|
||||||
|
@ -407,6 +408,10 @@ func (n *Node) compile(pctx *UnixParserCtx, ectx []EnricherCtx) error {
|
||||||
for _, pattern := range n.SubGroks {
|
for _, pattern := range n.SubGroks {
|
||||||
n.Logger.Tracef("Adding subpattern '%s' : '%s'", pattern.Key, pattern.Value)
|
n.Logger.Tracef("Adding subpattern '%s' : '%s'", pattern.Key, pattern.Value)
|
||||||
if err := pctx.Grok.Add(pattern.Key.(string), pattern.Value.(string)); err != nil {
|
if err := pctx.Grok.Add(pattern.Key.(string), pattern.Value.(string)); err != nil {
|
||||||
|
if err == grokky.ErrAlreadyExist {
|
||||||
|
n.Logger.Warningf("grok '%s' already registred", pattern.Key)
|
||||||
|
continue
|
||||||
|
}
|
||||||
n.Logger.Errorf("Unable to compile subpattern %s : %v", pattern.Key, err)
|
n.Logger.Errorf("Unable to compile subpattern %s : %v", pattern.Key, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue