variable as value for grok pattern #459
-
I have this VRL where the grok pattern for the log is based on the value of Log sample: {
"message": "INFO - Application started successfully.",
"fields": {
"application": "app2"
}
} VRL:
The error that I'm getting:
Tried different things with no luck. Any suggestions on how I can work around this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @camilisette ! At this time, |
Beta Was this translation helpful? Give feedback.
-
Just posting an update after trying this again with v0.33.0 of Vector which I believe should have #151 part of it. It still doesn't work when you have the pattern as part of a dictionary. |
Beta Was this translation helpful? Give feedback.
Hi @camilisette !
At this time,
parse_grok
requires a literal since compiling grok expressions at runtime is expensive. In your case the compiler could grow to be smart enough to realize that the variable will map to a literal that can be precompiled, but it isn't currently. Instead I think you'll need to useif/else
statements rather than a dictionary lookup. I think #151 is tracking improvements to the compiler that might enable the dictionary lookup you have.