Skip to content

Metrics filters are not working properly #21890

Answered by pront
uni-pooja-laad asked this question in Q&A
Discussion options

You must be logged in to vote

There's no tostring. There's a to_string coercion function.


1 │ match!(to_string(.name) ?? "default", r'^(cpu.*|kong.*|mem.*)')
  │ ^^^^^- remove this abort-instruction

^ This means that you can remove the ! like so so match(to_string(.name) ....

But you also need to handle the to_string error so the final version is:

match(to_string!(.name), r'^(cpu.*|kong.*|mem.*)')

(you can drop the "default" since it will never match)

I can see how this should be a warning instead of an error, worth requesting this here: https://github.com/vectordotdev/vrl/issues/new.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@pront
Comment options

@uni-pooja-laad
Comment options

@uni-pooja-laad
Comment options

@pront
Comment options

@pront
Comment options

Answer selected by pront
Comment options

You must be logged in to vote
0 replies
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