If I understand the requirements correctly, an alert sequence is one in which task_id is equal but a later event_id is greater than an earlier one, you can say that conceptually, you need a temporary...
See more...
If I understand the requirements correctly, an alert sequence is one in which task_id is equal but a later event_id is greater than an earlier one, you can say that conceptually, you need a temporary storage. But like most languages, SPL commands RAM for such transient needs. From your sample log, is the following what you are looking for? event_name task_id _time event_id server_state 0 2023-08-01 15:41:40.395,2023-08-01 15:10:40.395 1545468 1545467 server_state 1 2023-08-01 15:45:40.395,2023-08-01 15:15:40.395 1135465 1135464 server_state 2 2023-08-01 15:50:40.395,2023-08-01 15:25:40.395 1201257 1201256 server_state 3 2023-08-01 15:52:40.395,2023-08-01 15:36:40.395 1223681 1223680 You can achieve this with the following assuming that event_name, task_id, and event_id are already extracted: | stats list(_time) as _time list(event_id) as event_id by event_name task_id
| where mvindex(_time, 0) > mvindex(_time, -1) AND mvindex(event_id, 0) > mvindex(event_id, -1)
OR mvindex(_time, 0) < mvindex(_time, -1) AND mvindex(event_id, 0) < mvindex(event_id, -1)
| fieldformat _time = strftime(_time, "%F %H:%M:%S.%3Q") Here is an emulation of your sample data that you can play with and compare with real data. | makeresults
| eval data = split("8/01/2023 3:52:40.395 PM server_state|3 1223681 5
8/01/2023 3:50:40.395 PM server_state|2 1201257 3
8/01/2023 3:45:40.395 PM server_state|1 1135465 2
8/01/2023 3:41:40.395 PM server_state|0 1545468 5
8/01/2023 3:36:40.395 PM server_state|3 1223680 0
8/01/2023 3:25:40.395 PM server_state|2 1201256 2
8/01/2023 3:15:40.395 PM server_state|1 1135464 3
8/01/2023 3:10:40.395 PM server_state|0 1545467 8", "
")
| mvexpand data
| rename data as _raw
| rex "(?<ts>(\S+\s){3}) (?<event_name>\w+)\|(?<task_id>\d+) (?<event_id>\d+)"
| eval _time = strptime(ts, "%m/%d/%Y %I:%M:%S.%3Q %p")
``` data emulation above ``` Hope this helps.