I have to remember date from one line and use it while processing event_timestamp filed on other lines of log file. For this I am using aggregate filter. Please guide what I am doing wrong here or any other way to do it?
My desired output is event_timestamp should contain where is the remembered value from TIMESTAMP line and is the event time of message in the log file.
My data :
14:03:03 (lmgrd) TIMESTAMP 5/13/2019
15:56:24 (cdslmd) OUT: "PKC0603" mnarasim@dlhsx00012
15:56:32 (cdslmd) OUT: "Analog_Design_Environment_XL" gautamd@dlhsx00005
My config :
filter {
grok {
match => [ "message", "%{DATA:event_timestamp} (%{DATA:lmgrd}) TIMESTAMP %{DATE:monthday}" ]
tag_on_failure => [ "message_data" ]
}
mutate {
add_field => { "taskId" => "all" }
}
if "message_data" not in [tags] {
aggregate {
task_id => "%{taskId}"
code => "map['monthday'] = event.get('monthday')"
}
}
else {
aggregate {
task_id => "%{taskId}"
code => "try = event.set('monthday', map['monthday'])"
map_action => "update"
}
grok {
match => [ "message", "%{TIME:event_timestamp} \(%{DATA:lic_vendor_name}\) (?<event_type>(OUT|IN|DENIED))\: \"%{DATA:lic_feature_name}\" %{DATA:user_name}@%{HOSTNAME:host_name}" ] }
mutate { replace => ["event_timestamp", "%{event_timestamp} %{try}" ] }
}
My output
"event_timestamp" => "15:56:24 %{try}"
"user_name" => "gautamd",
"source" => "/home/msk/cadence-cdslmd-dlhl0939_dlhl0940_dlhl0941.log",
"message" => "15:56:32 (cdslmd) OUT: \"Analog_Design_Environment_XL\" gautamd@dlhsx00005 ",
"beat" => {
"name" => "dlhl2117",
"hostname" => "dlhl2117",
"version" => "6.4.2"
},
"@timestamp" => 2019-06-07T08:16:28.915Z,
"host" => {
"name" => "dlhl2117"
},
"fields" => {
"document_type" => "fle-type"
},
"taskId" => "all",
"lic_feature_name" => "Analog_Design_Environment_XL",
"offset" => 92,
"event_timestamp" => "15:56:32 %{try}"
}
{
"event_type" => "OUT",
"@version" => "1",
"host_name" => "dlhsx00012",
"prospector" => {
"type" => "log"