Reputation: 443
I would like to Calculate Time difference between two operation where operation name contains ID using kusto query. please find attached snapshot that contains table and required output. It would be helpful if anyone can share Kusto query to achieve the same.
timestamp [IST] name
2022/30/6, 4:10:00.460 AM fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached Three
2022/30/6, 4:12:00.091 AM fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached Two
2022/30/6, 4:10:00.460 AM ewerewtetete-4d07-adfb-7090a207e667 Retry message
2022/30/6, 4:14:10.791 AM fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached One
2022/30/6, 4:15:10.460 AM ewerewtetete-4d07-adfb-7090a207e667 Success: Reached Three
2022/30/6, 4:20:04.343 AM fbf759a0-d4be-4d07-adfb-7090a207e667 Retry message
Output
Time Difference by operationID(which is part of name) in seconds
fbf759a0-d4be-4d07-adfb-7090a207e667 604
ewerewtetete-4d07-adfb-7090a207e667 310
Upvotes: 3
Views: 3067
Reputation: 44981
datatable(['timestamp [IST]']:datetime, name:string)
[
"2022-06-30 04:10:00.460" ,"fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached Three"
,"2022-06-30 04:12:00.091" ,"fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached Two"
,"2022-06-30 04:10:00.460" ,"ewerewtetete-4d07-adfb-7090a207e667 Retry message"
,"2022-06-30 04:14:10.791" ,"fbf759a0-d4be-4d07-adfb-7090a207e667 Success: Reached One"
,"2022-06-30 04:15:10.460" ,"ewerewtetete-4d07-adfb-7090a207e667 Success: Reached Three"
,"2022-06-30 04:20:04.343" ,"fbf759a0-d4be-4d07-adfb-7090a207e667 Retry message"
]
| project-rename ts = ['timestamp [IST]']
| parse name with OperationID " " *
| summarize TimeDiffSec = round((max(ts) - min(ts)) / 1s) by OperationID
OperationID | TimeDiffSec |
---|---|
fbf759a0-d4be-4d07-adfb-7090a207e667 | 604 |
ewerewtetete-4d07-adfb-7090a207e667 | 310 |
Upvotes: 1