Parsleaf

Google SecOps parser errors

error parsing regexp (grok works in a debugger, fails in SecOps)

SecOps grok uses Go's RE2 engine. Lookarounds, backreferences, possessive and atomic groups are not supported, and backslashes need escaping in the parser file.

The error

pipeline failed: filter grok (1) failed: failed to parse data: error parsing regexp: invalid or unsupported Perl syntax

Why it happens

Online grok debuggers use the Oniguruma engine, which accepts more syntax than SecOps does. A pattern can work there and fail here.

Not supported in SecOps: lookahead and lookbehind ((?=…), (?<=…)), backreferences (\1), possessive quantifiers (.*+) and atomic groups ((?>…)).

Inside the parser file, regex backslashes are written twice: \s becomes \\s.

How to fix it

Fails:

"message" => "(?<=user=)\\w+"

Works:

"message" => "user=(?P<user>\\w+)"

Still failing?

One error usually hides the next. Parsleaf writes the full parser from your sample logs and keeps fixing it from the errors your SecOps tenant returns, until it passes. Generate your parser: the first one is free.

Other parser errors