Skip to content

In the array / variable search, how most effective ? #10791

Answered by spencergilbert
StefanSa asked this question in Q&A
Discussion options

You must be logged in to vote

Slightly different from your existing example, but with this example event:

$ .
{ "message": "foobar", "serialnumber": "SN01" }

And a variable in VRL set to an object of serialnumber => hostname k/v's

$ hosts
{ "SN01": "host01", "SN02": "host02" }

You could use the get function to dynamically pull the value from your hosts object:

$ get!(hosts, [.serialnumber])
"host01"

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@StefanSa
Comment options

@jszwedko
Comment options

@StefanSa
Comment options

@jszwedko
Comment options

@StefanSa
Comment options

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