mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
add a warning when a grok pattern ends with \n (#183)
This commit is contained in:
parent
742435f178
commit
1956f52be5
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ package parser
|
|||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
|
||||
|
@ -412,6 +413,9 @@ func (n *Node) compile(pctx *UnixParserCtx) error {
|
|||
n.logger.Debugf("%s regexp: %s", n.Grok.RegexpName, n.Grok.RunTimeRegexp.Regexp.String())
|
||||
valid = true
|
||||
} else if n.Grok.RegexpValue != "" {
|
||||
if strings.HasSuffix(n.Grok.RegexpValue, "\n") {
|
||||
n.logger.Debugf("Beware, pattern ends with \\n : '%s'", n.Grok.RegexpValue)
|
||||
}
|
||||
//n.logger.Debugf("+ Regexp Compilation '%s'", n.Grok.RegexpValue)
|
||||
n.Grok.RunTimeRegexp, err = pctx.Grok.Compile(n.Grok.RegexpValue)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue