Agent Foskett Academy • Lesson 4 • Filtering KQL Results
Filtering KQL Results
Filtering is where KQL starts becoming powerful.
A table may contain thousands, millions or even billions of events. The investigator's job is not to stare at everything. The job is to narrow the data until the important activity becomes visible.
In this lesson, you will learn how to use common KQL filters such as where, contains, has, == and time filtering to reduce noise inside Microsoft Defender XDR and Microsoft Sentinel.
The goal is simple:
Start broad. Filter carefully. Follow the evidence.
Learn how to use common KQL filters to reduce noise, focus investigations and find the events that matter.
Plain-English filtering introduction
where, contains, has and ==
Filtering telemetry during investigations
🧠 Filtering is how investigators reduce the noise. Dashboards show summaries. KQL filters help defenders focus on the specific users, devices, domains, timestamps and events that matter.
Microsoft security telemetry can be extremely noisy. A single tenant may generate thousands of sign-ins, email events, URL clicks and endpoint events every day. Filtering helps you narrow the data to the activity you actually need to investigate.
Reduce the noiseFilters help you remove irrelevant events and focus on the activity connected to the investigation.
Find patterns fasterFiltering by user, sender domain, timestamp, device name or URL can make suspicious patterns easier to see.
Ask better questionsGood filtering turns a broad query into a focused investigation question.
The where operator
The where operator is one of the most important parts of KQL. It keeps rows that match a condition and removes rows that do not.
where-filter-example.kql
1
2
3
4
5
EmailEvents| whereTimestamp > ago(24h)
| take20
Plain-English translation:
Show me email events from the last 24 hours, then return 20 rows.
Filtering by time
Time filtering is usually one of the first filters defenders apply. It prevents the query from searching too much history and helps focus the investigation window.
Last 24 hoursUseful when investigating recent alerts, user reports or suspicious activity that happened today.
Last 7 daysUseful when checking whether suspicious behaviour has repeated over the last week.
Custom timeframeUseful when an incident has a known start time, such as a reported phishing email or suspicious sign-in.
time-filtering.kql
1
2
3
4
5
SigninLogs| whereTimeGenerated > ago(7d)
| take50
Using == for exact matches
Use == when you want an exact match. This is useful when you know the precise value you are looking for, such as a sender domain, user principal name, device name or application.
Show me email events where the sender domain is exactly paypal.com.
Using contains for partial matches
Use contains when you want to search for text inside a larger value. This is useful for subject lines, URLs, file names, command lines and fields where the exact full value may not be known.
Show me email events where the subject contains the word invoice.
Using has for word-based matching
Use has when you want to match a whole term rather than any partial text. It can be useful when you want cleaner word-based matching inside fields such as subjects, command lines or URLs.
In this lesson, you learned how filtering helps defenders reduce noise and focus on useful evidence inside Microsoft security telemetry.
where filters rowsThe where operator keeps only the events that match your investigation condition.
Time filters focus the windowFiltering by time helps keep investigations focused, fast and relevant.
Different filters answer different questionsUse == for exact matches, contains for partial text and has for term-based matching.
Next lesson coming soon
The next Agent Foskett Academy lesson will build on filtering and show how to choose useful columns with project, so your results show only the evidence that matters.
Lesson 5 — Choosing Useful ColumnsLearn how project helps investigators remove clutter and focus on the fields that matter most.
Keep building the investigationAfter filtering results, the next step is deciding which fields help explain what happened.
Develop IT. Protect IT.GEMXIT PTY LTD | GEMXIT UK LTD
Filtering KQL Results
Agent Foskett Academy Lesson 4 teaches defenders how to filter KQL results using where, contains, has, exact matches and time filtering inside Microsoft Defender XDR and Microsoft Sentinel.
Learn KQL Filtering for Microsoft Defender XDR
KQL filters help defenders reduce noisy telemetry, focus on suspicious users, domains, devices, URLs and events, and follow evidence across Microsoft security investigations.