Ah, the original design did not consider the possibility of mixed increment and no-increment. Now, to deal with this, you will need to tell us whether you want to catch any duplicate regardless of i...
See more...
Ah, the original design did not consider the possibility of mixed increment and no-increment. Now, to deal with this, you will need to tell us whether you want to catch any duplicate regardless of interleave, or whether you want to catch only "consecutive" events that duplicate event_id, because the two use cases are very different. If only consecutive duplicate event_id should trigger alert, you can do | delta event_id as delta
| stats list(_time) as _time values(delta) as delta by event_id event_name task_id
| where delta == "0"
| fieldformat _time = strftime(_time, "%F %H:%M:%S.%3Q") To test this use case, I construct the following extended test dataset based on your illustration. Time _time event_id event_name task_id 9/4/22 10:03:39 PM 2022-09-04 22:03:39 1274851 pending-transfer 3 9/4/22 10:02:39 PM 2022-09-04 22:02:39 1274856 pending-transfer 3 9/4/22 09:57:39 PM 2022-09-04 21:57:39 1274856 pending-transfer 3 9/4/22 09:52:39 PM 2022-09-04 21:52:39 1274856 pending-transfer 3 9/4/22 09:47:39 PM 2022-09-04 21:47:39 1274851 pending-transfer 3 9/4/22 09:37:39 PM 2022-09-04 21:37:39 1274849 pending-transfer 3 And the result is a single row event_id event_name task_id _time delta 1274856 pending-transfer 3 2022-09-04 22:02:39.000,2022-09-04 21:57:39.000,2022-09-04 21:52:39.000 0 5 If, on the other hand, the alert should be triggered no matter which other event_id's are in between, you should do | stats list(_time) as _time by event_id event_name task_id
| where mvcount(_time) > 1
| fieldformat _time = strftime(_time, "%F %H:%M:%S.%3Q") Using the same test dataset as illustrated above, you should see two outputs event_id event_name task_id _time 1274851 pending-transfer 3 2022-09-04 22:03:39.000,2022-09-04 21:47:39.000 1274856 pending-transfer 3 2022-09-04 22:02:39.000,2022-09-04 21:57:39.000,2022-09-04 21:52:39.000 Here is data emulation that you can play with and compare with real data | makeresults
| eval _raw = "Time event_name task_id event_id
9/4/22 10:03:39 PM pending-transfer 3 1274851
9/4/22 10:02:39 PM pending-transfer 3 1274856
9/4/22 09:57:39 PM pending-transfer 3 1274856
9/4/22 09:52:39 PM pending-transfer 3 1274856
9/4/22 09:47:39 PM pending-transfer 3 1274851
9/4/22 09:37:39 PM pending-transfer 3 1274849"
| multikv
| eval _time = strptime(Time, "%m/%d/%y %I:%M:%S %p")
| fields - linecount _raw
``` data emulation above ```