ago() / now()

now() returns the current date and time (UTC). ago(span) returns the time span before now: ago(1h) is one hour ago, ago(7d) one week ago. It is the same as now() - span.

SigninLogs
| where TimeGenerated > ago(1d)

This is the most common first line after a table name: it limits the query to recent data. On a real workspace that is also what keeps queries fast.

The argument is a time span such as 30m, 12h, 7d (see datetime and time spans). ago() with a negative span points into the future, but now() + span is clearer for that.

The fixed “now” on this site

The data here is fictional and does not move. To keep results the same for everyone, now() is fixed at 2026-06-15 12:00:00 UTC, the end of the dataset. So ago(1d) always means 2026-06-14 12:00:00. In Microsoft Sentinel or Defender, now() is the real current time, so the same query returns different rows from one minute to the next.

Things to know

  • All times in Kusto are UTC. A “last night” query for a team in Prague has to account for the offset.
  • now() is evaluated once per query, so every row sees the same value.

Examples

1 Sign-ins in the last hour
SigninLogs
| where TimeGenerated > ago(1h)
| project TimeGenerated, UserPrincipalName, AppDisplayName
2 What now() and ago() return here
print Now = now(), DayAgo = ago(1d), WeekAgo = ago(7d), Later = now() + 90m

On this site "now" is fixed at 15 June 2026, 12:00 UTC, so every result is the same for everyone.

3 Windows events of the last two days
SecurityEvent
| where TimeGenerated > ago(2d)
| summarize Events = count() by EventID

Practice it

None of the free exercises needs this one yet.