Skip to content

parse_grok! expression can't fail even though it's marked fallible #22100

Answered by jszwedko
kvberge asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kvberge !

The issue here is that you are using a ! when calling parse_grok(). That is, you are using parse_grok!() rather than parse_grok(). The ! tells VRL to abort if the function call fails and so the ?? expression you have here will never be executed. Instead you likely want:


1 │   structured =  parse_grok(.message, "%{TIME:time}%{SPACE}%{POSINT:pid}%{SPACE}%{BASE16NUM:thread}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{WORD:category}%{SPACE}%{PROG:prog}%{SPACE}%{GREEDYDATA:message}") ?? {"message":.message, "level": "info" }

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kvberge
Comment options

@jszwedko
Comment options

Answer selected by kvberge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants