I have a data structure looking like this:
printed as codec => rubydebug
{
"sequence_number" => 557,
"event_tags" => [
[0] {
"value" => "nacl-st-qkrrfq-ppu-server-6y35vxntjont",
"key" => "originhost"
}
]
.
.
.
.
}
or printed as codec => line
"event_tags":[{"value":"nacl-st-alcags-ppu-server-zwul4nphc2lc","key":"originhost"}]
or from kibana:
event_tags {
"value": "nacl-st-ibgki7-ppu-server-bl46vcsakx5f",
"key": "originhost"
}
I would like ta add a field calld "originhost" which has the value "nacl-st-alcags-ppu-server-zwul4nphc2lc" in this example.
I have tried the following in a mutate filter:
add_field => {"originhost" => "%{[0][event_tags][key]}"}
and
add_field => {"originhost" => "%{[event_tags][key]}"}
but it does not work.
The second one causes java errors in logstash log and the first one "originhost = %{[0][event_tags][key]}"
How should I write the filter?
Br Mathias