Hi Everyone,
I need to add one timestamp value to JSON. i share u code n output
input
{
stdin{}
}
filter{
if ([message] =~ "{\"index") {
drop {}
}
json {
source => "message"
target => "parsedJson"
}
}
if ([parsedJson][frame]) {
mutate {
add_field => {
"{[parsedJson][frame][timestamp]}" => "%{[parsedJson][timestamp]}"
}
}
mutate {
add_field => {
"frame" => '%{[parsedJson][frame]}'
}
}
}
}
output{
stdout{}
}
I'm trying to add timestamp as value to frame JSON i will share sample json output which i got. this is the frame json
{"frame_frame_interface_id":"0","frame_interface_id_frame_interface_name":"eth0","frame_frame_encap_type":"1","frame_frame_offset_shift":"0.000000000","frame_frame_time_epoch":"1550562075.603254333","frame_frame_time_delta":"0.000509962","frame_frame_time_delta_displayed":"0.000509962","frame_frame_time_relative":"12.076067648","frame_frame_number":"228","frame_frame_len":"1514","frame_frame_cap_len":"1514","frame_frame_marked":"0","frame_frame_ignored":"0","frame_frame_protocols":"eth:ethertype:ip:udp:data"}
but i want output as
{"frame_frame_interface_id":"0","frame_interface_id_frame_interface_name":"eth0","frame_frame_encap_type":"1","frame_frame_offset_shift":"0.000000000","frame_frame_time_epoch":"1550562075.603254333","frame_frame_time_delta":"0.000509962","frame_frame_time_delta_displayed":"0.000509962","frame_frame_time_relative":"12.076067648","frame_frame_number":"228","frame_frame_len":"1514","frame_frame_cap_len":"1514","frame_frame_marked":"0","frame_frame_ignored":"0","frame_frame_protocols":"eth:ethertype:ip:udp:data","timestamp":"2019-02-19T08:07:28.847Z"}
pls help me solve this issue.