~/KQL-example-generator ☀ LIGHT Local Only ☕ Support me apps KQL Visualizer → ← about me
██╗ ██╗ ██████╗ ██╗ ███████╗██╗ ██╗ █████╗ ███╗ ███╗██████╗ ██╗ ███████╗ ██████╗ ███████╗███╗ ██╗███████╗██████╗ █████╗ ████████╗ ██████╗ ██████╗ ██║ ██╔╝██╔═══██╗██║ ██╔════╝╚██╗██╔╝██╔══██╗████╗ ████║██╔══██╗██║ ██╔════╝ ██╔════╝ ██╔════╝████╗ ██║██╔════╝██╔══██╗██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗ █████╔╝ ██║ ██║██║ █████╗ ╚███╔╝ ███████║██╔████╔██║██████╔╝██║ █████╗ ██║ ███╗█████╗ ██╔██╗ ██║█████╗ ██████╔╝███████║ ██║ ██║ ██║██████╔╝ ██╔═██╗ ██║▄▄ ██║██║ ██╔══╝ ██╔██╗ ██╔══██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝ ██║ ██║██╔══╝ ██║╚██╗██║██╔══╝ ██╔══██╗██╔══██║ ██║ ██║ ██║██╔══██╗ ██║ ██╗╚██████╔╝███████╗ ███████╗██╔╝ ██╗██║ ██║██║ ╚═╝ ██║██║ ███████╗███████╗ ╚██████╔╝███████╗██║ ╚████║███████╗██║ ██║██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═╝ ╚═╝ ╚══▀▀═╝ ╚══════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝

KQL Generator_

Generate production-ready Microsoft Sentinel KQL queries · 40+ templates · instant

Showing 0 queries

Guide — a working KQL query in five steps

Pick a category, copy the query, adapt it to your workspace.
1Pick a category

Identity & access, threat intelligence, email, network, endpoint, Azure activity, malware, Defender, cloud discovery or compliance.

2Read the generated query

Each query comes with inline comments that explain every operator and clause.

3Set table and time range

Override the target table (for example SecurityEvent) and pick the time range; then adjust filters and thresholds in the query.

4Copy or download

Copy All or Download .kql to keep the queries as plain text.

5Run it

Paste into Microsoft Sentinel, Log Analytics or Defender XDR advanced hunting, or save it as a hunting query or analytics rule.

Where the queries run

SENTINELMicrosoft Sentinel
Logs
paste into the query editor
rules
save as hunting query or analytics rule
DEFENDERDefender XDR
hunting
Device* tables in advanced hunting
MONITORAzure Monitor
Log Analytics
workspace queries and workbooks

KQL query examples for Sentinel and Defender, explained

This generator produces commented KQL (Kusto Query Language) queries for common security and monitoring scenarios in Microsoft Sentinel, Azure Monitor and Defender XDR. Below: what KQL is, which tables are covered, how to adapt and save the queries, and what they are typically used for.

What is KQL and how does it work?

KQL stands for Kusto Query Language, the query language powering Microsoft Azure security and monitoring services. It's used in Microsoft Sentinel, Azure Monitor, Log Analytics, Microsoft Defender XDR, and Application Insights. KQL uses a pipe-based syntax to filter, aggregate, transform, and visualize massive log datasets — making it essential for security operations and threat hunting.

What does this KQL query generator do?

This tool generates production-ready KQL query examples for common security monitoring and investigation use cases. Select a scenario or data table, and the generator outputs syntactically correct, commented KQL queries you can paste directly into Microsoft Sentinel, Log Analytics, or Azure Monitor without modification.

Which log tables and data sources are supported?

The generator covers the most commonly used tables including SigninLogs, AuditLogs, SecurityEvent, DeviceEvents, OfficeActivity, CommonSecurityLog, Syslog, and many more. New examples are continuously added based on real-world SOC operations and security admin use cases.

Do I need KQL knowledge to use this generator?

No. This tool is designed for both beginners and experienced analysts. Generated queries include inline comments explaining each operation and clause. They serve as a learning resource — reading and modifying real-world KQL queries is the fastest way to master the language and understand Azure Sentinel data structures.

Can I use generated KQL queries in Microsoft Sentinel?

Yes, directly. All queries are written for the Log Analytics workspace schema used by Microsoft Sentinel. Copy and paste them into the Sentinel Logs query editor, or save them as Saved Searches, Analytics Rules, Detection Rules, or Hunting Queries for automated threat detection.

How do I modify generated KQL queries for my environment?

Generated queries are fully editable. Modify table names, filter conditions, time ranges, and aggregations to match your specific security monitoring requirements. Comments in the query explain what each section does, making it easy to customize queries for your threat hunting or investigation workflow.

What are common use cases for KQL examples?

Security teams use KQL examples for threat hunting, investigating suspicious sign-in patterns, detecting lateral movement, analyzing security events, identifying data exfiltration attempts, and automating threat detection rules. System administrators use KQL for Azure resource auditing, access compliance monitoring, and operational troubleshooting.

Can I export or save generated KQL queries?

Yes. Copy generated queries from the output area and paste them into Microsoft Sentinel, save them to files, or version control them in your security automation scripts. Queries are plain text and compatible with all KQL tools and Azure services.

More free tools