@richgalloway I have another query: event_status="delivered" OR event_status="in_transit"
| transaction tracking_number startswith=event_status=delivered endswith=event_status=in_transit keepevicted=true
| where duration > 3600
| search closed_txn=1 Which returned 5 transactions fit for this condition for the last 2 weeks. Here's one of those(accidentally fits my final requirement): {"timestamp":"2023-07-06T23:44:52.784Z","tracking_number":"C11900891311111","event_status":"delivered","event_time":"2023-07-06T23:44:38.722Z"}
{"timestamp":"2023-07-07T07:03:10.712Z","tracking_number":"C11900891311111","event_status":"in_transit","event_time":"2023-07-03T18:24:36.668Z"} If we take a look at event_time field of the delivered event and assume that it will replace _time field for it, then after comparison of two timestamps in_transit event clearly came 8 hours after the first one. For some reason, these 5 transactions are not included in the total calculations in the query that you helped me to compose: event_status="delivered" OR event_status="in_transit"
| eval _time=if(event_status="delivered", strptime(event_time, "%Y-%m-%dT%H:%M:%S.%3N%Z"), _time)
| sort - _time
| transaction tracking_number startswith=event_status=delivered endswith=event_status=in_transit keepevicted=true
| where duration > 3600
| stats sum(eventcount) as eventcount by closed_txn
| eventstats sum(eventcount) as totalcount
| where closed_txn == 1``` remaining eventcount only includes complete transactions ```
| eval percentage = eventcount * 100 / totalcount The strange thing is - I tried singling this transaction this way: event_status="delivered" OR event_status="in_transit" AND "C11900891311111"
| eval _time=if(event_status="delivered", strptime(event_time, "%Y-%m-%dT%H:%M:%S.%3N%Z"), _time)
| sort - _time
| transaction tracking_number startswith=event_status=delivered endswith=event_status=in_transit keepevicted=true
| where duration > 3600
| stats sum(eventcount) as eventcount by closed_txn And successfully found it! But removing condition AND "C11900891311111" at the start of the query gives me 0 results. This is very strange, right? P.S. Sorry for my continuous inquiries, I just really want to get to the root of the problem. I will upvote your answers as well!
... View more