Agent Foskett Academy • Lesson 8 • Finding Time Patterns with bin()
Finding Time Patterns with bin()
Security investigations are not only about what happened.
They are also about when it happened.
A single failed login may not matter. A hundred failed logins within two minutes changes the investigation completely.
Attackers often generate bursts of activity: password spray attempts, MFA fatigue prompts, email floods, suspicious sign-in spikes, endpoint execution bursts and sudden outbound data transfers.
The bin() function helps defenders group telemetry into time windows so timing patterns become easier to identify.
In this lesson, you will learn how to use bin() in KQL to organise Microsoft Defender XDR and Sentinel telemetry into meaningful time ranges for investigation.
Because sometimes the pattern is hidden in the timing.
Learn how to use bin() to group security telemetry into time intervals and identify spikes, bursts and suspicious behavioural patterns.
Understanding time-based grouping
Using bin() with security telemetry
Finding spikes and attack bursts
🕒 Attackers often reveal themselves through timing patterns. bin() helps defenders group telemetry into time windows so unusual behaviour becomes easier to detect.
Count sign-in events in 1-hour blocks over the last 24 hours.
Understanding bin()
bin() rounds each timestamp down into a matching time bucket. That bucket becomes the group used by summarize.
bin() creates time windowsbin() groups timestamps into intervals such as 5 minutes, 1 hour or 1 day.
Patterns become visibleGrouping events by time helps defenders identify unusual spikes and repeated bursts of activity.
Perfect for investigationsTime grouping is useful for sign-in analysis, phishing campaigns, endpoint activity and authentication attacks.
Choosing the right time window
The interval you choose matters. A very small time window may create too much detail. A very large time window may hide the spike you are trying to find.
5 minutesUseful for fast activity such as password sprays, MFA prompt bursts or sudden endpoint events.
1 hourUseful for daily investigation patterns such as sign-in trends, email surges or cloud activity.
1 dayUseful for longer trend reviews, weekly baselines and slow-moving operational patterns.
Detecting failed sign-in bursts
Failed sign-ins are easier to understand when grouped over time. A small number of failures spread across a day may be normal. A large burst in a short window may indicate attack activity.
Time windowbin(TimeGenerated, 15m) creates 15-minute blocks.
User groupingUserPrincipalName shows which account generated the failed attempts.
Investigation shortlistThe where line after summarize reduces the output to higher-volume suspicious windows.
Email bursts over time
bin() is also useful for email investigations. Sudden spikes in email volume may indicate phishing campaigns, compromised senders, noisy systems or bulk external delivery.
Count email events in 30-minute blocks to see when email activity increased.
Endpoint activity bursts
Endpoint behaviour can also appear in bursts. A suspicious process may execute repeatedly in a short time window, or a script may launch across multiple devices during an incident.
In this lesson, you learned how bin() helps defenders group Microsoft security telemetry into time windows and reveal time-based investigation patterns.
bin() groups timebin() rounds timestamps into fixed intervals such as 15 minutes, 1 hour or 1 day.
summarize counts each windowUsing summarize with bin() helps measure how much activity occurred during each time block.
timing reveals behaviourSpikes and bursts can show password spray attempts, phishing campaigns, endpoint activity or suspicious sign-in patterns.
Next lesson coming soon
The next Agent Foskett Academy lesson will introduce distinct, helping defenders find unique users, devices, IP addresses, senders, domains and other values inside Microsoft security telemetry.
Lesson 9 — Finding Unique Values with distinctLearn how distinct helps defenders reduce repeated rows and identify unique accounts, IPs, devices, domains and senders.
Keep building the investigationAfter grouping activity over time, the next step is learning how to remove repetition and focus on unique evidence.
Develop IT. Protect IT.GEMXIT PTY LTD | GEMXIT UK LTD
Finding Time Patterns with bin() in KQL
Agent Foskett Academy Lesson 8 teaches defenders how to use bin() inside Microsoft Defender XDR and Microsoft Sentinel investigations to group telemetry into time windows.
Learn KQL bin() for Microsoft Defender XDR
KQL bin() helps defenders identify spikes, bursts, repeated behaviour and suspicious timing patterns across Microsoft security telemetry.
KQL Time Pattern Analysis for Security Investigations