Custom grok pattern file parsing error

I have a custom grok pattern file with following regex patterns. I successfully tested these using regex online tool and it works fine however logstash fails to load the custom patterns file - see below. Appreciate your input.

Custom Regex:

LEVEL \[[A-Z][A-Z][A-Z][A-Z]*. *\]
CODE [[a-z][a-z][a-z]*. *\]

Input:
[2019-01-08 01:49:04] [INFO ] [abcd] No data file found, creating one and starting executor

Logstash config:
filter {
grok {
patterns_dir => ["/usr/share/logstash/pipeline/patterns"]
match => { "message" => "%{LEVEL:level} %{CODE:code}" }
}
}

Error
premature end of char-class: /(?LEVEL:level[[A-Z][A-Z][A-Z][A-Z]*. ]) (?CODE:code[[a-z][a-z][a-z]. *])/m>,

You need to edit your post and either select the regexps and click on </> or precede and follow them with a line containing just three backticks ```

Currently the formatting is changing what appears in the post. The italics suggest there might be underscores in there, but we cannot see them.

I have formatted the regex as you requested. Thanks for your time.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.