Hello team,
I have case where information is being displayed in different lines. These lines are not even consecutive lines. Unique field is log_processed.companyId. I have to display time difference between entry and exit log.
I have tried with aggregate filter but it didn't work
Sample log:
{"timestamp":"2021-11-17T05:52:59:613","level":"info","message":"ENTRY: INTERNAL_HTTP_REQUEST","userId":"rahul","companyId":"abc"}
{"timestamp":"2021-11-17T05:52:59:768","level":"info","message":"EXIT: INTERNAL_HTTP_REQUEST","userId":"rahul","companyId":"abc"}
Aggregate filter:
if [log_processed.message] == "ENTRY: INTERNAL_HTTP_REQUEST" {
aggregate {
task_id => "%{log_processed.companyId}"
code => "map['started'] = event['@timestamp']"
map_action => "create"
}
}
if [log_processed.message] == "EXIT: INTERNAL_HTTP_REQUEST" {
aggregate {
task_id => "%{log_processed.companyId}"
code => "event['duration'] = event['@timestamp'] - map['started']"
map_action => "update"
push_map_as_event_on_timeout => true
timeout_task_id_field => "log_processed.companyId"
timeout => 60 # 1 minutes timeout
timeout_tags => ['_aggregatetimeout']
}
}