Scalar functions
Scalar functions take a value and perform some sort of manipulation on it to return a different value. They are useful for performing conversions between data types, looking at only part of the variable, and performing mathematical computations.
The ago() function
The ago()
function is used to subtract a specific timespan from the current UTC time. Remember that all times stored in the Log Analytics log are based on UTC time, unless they are times in a custom log that are specifically designed not to be. Generally, it is safe to assume that the times stored are based on UTC time.
If I wanted to look for events in StormEvents
that ended less than an hour ago, I would use the following command. Note that this command doesn't return any values as the times stored are from 2007:
StormEvents | where EndTime > ago(1h)
In addition to using h
for hours, you can also use d
for days, among others.