I have a string field named "One".
<165>Original Address=1.1.1.1 1 2021-01-28T15:08:03.136-05:00 DeviceName - - - - fpc3 DHCP Packet Drop: Packet src ip/mac 192.168.123.1/54:48:10:db:86:b6
I use
mutate {
split => {"One" => " "}
}
To split on the space. Which looks like this:
<165>Original, Address=1.1.1.1, Jan, 28, 16:38:42, DeviceName, fpc3, DHCP, Packet, Drop:, Packet, src, ip/mac, 192.168.123.1/54:48:10:db:86:b6
I then use
mutate {
add_field => { "Hostname" => "%{One[5]}" }
}
To create a new field named "Hostname" and use the data in index 5 of the "One" field. However, I get this error in the logstash logs:
Exception caught while applying mutate filter {:exception=>"Invalid FieldReference: `One[5]`"}
According to this documentation, it should work: