In the array / variable search, how most effective ? #10791
-
I have a syslog device that does not send the hostname, but the serial number. Currently i create the hostname in number of devices over several "if" queries. My question now how to search in this variable / array for the SN and then assign it to the matching host ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 18 replies
-
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!(hosts, [.serialnumber])
"host01" |
Beta Was this translation helpful? Give feedback.
Slightly different from your existing example, but with this example event:
And a variable in VRL set to an object of serialnumber => hostname k/v's
You could use the
get
function to dynamically pull the value from yourhosts
object: