Convert UTC 'TimeGenerated' to local time in Azure monitor/log/analytics, when using "summarize by"
I have this simple query
MyLog
| summarize avg(executionTimeInMS_d) by bin(TimeGenerated, 5min)
I'd like the summary to be in my local time zone, not UTC. This does not work :
MyLog
| summarize avg(executionTimeInMS_d) by bin(TimeGenerated-5, 5min)
Can this be done?
Solution 1:
datetime
values are in UTC.
if you know the timezone offset (at the time you run the query), you can subtract/add it to your datetime
values as explained here: https://docs.microsoft.com/en-us/azure/kusto/query/datetime-timespan-arithmetic
for example: print now() - 7h