Skip to content

KQL & SPL Query Builder

Pick a data source, add filters and an aggregation, and get equivalent Sentinel KQL and Splunk SPL. The SPL-to-KQL Rosetta Stone is in the cheat sheet below.

100% Local Browser Execution • Zero Server Uploads • Air-Gap Safe

100% Local Tool Execution • Tool Inputs Never Leave Your Browser Query AST emitter

Time range
Filters (all must match)

Microsoft Sentinel KQL

SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID == 4625
| summarize Count = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by Account
| where Count > 10
| order by Count desc

Splunk SPL

index=wineventlog sourcetype="WinEventLog:Security" earliest=-24h EventCode=4625
| stats count, min(_time) as first_seen, max(_time) as last_seen by Account_Name
| where count > 10
| sort - count
| convert ctime(first_seen) ctime(last_seen)

Field names follow Sentinel’s built-in tables and the Splunk Windows, Sysmon and Azure add-ons. Adjust them to your data model before alerting.

CtrlEnter to copy output

Wrong result, broken layout or an idea? Tell us about this tool.

KQL & SPL Query Builder KQL and Splunk SPL Threat Hunting Query & Security Architecture Banner

Build Microsoft Sentinel KQL and Splunk SPL queries side by side from visual filter rows, or start from one of 25 SOC hunting presets covering brute force, encoded PowerShell, LSASS access, new admin accounts and more. The Rosetta Stone table maps every common Splunk command to its KQL equivalent, which is useful when you are migrating detections or working in both SIEMs. Field names and values are never sent anywhere.

KQL query basics

Kusto Query Language (KQL) is the read-only query language behind Microsoft Sentinel, Defender XDR advanced hunting, Azure Monitor Log Analytics and Azure Data Explorer. A KQL query starts with a table and pipes rows through operators: SecurityEvent | where EventID == 4625 | summarize count() by Account.

The most useful operators are where (filter), project (choose columns), extend (computed columns), summarize (aggregate), join (combine tables), parse and extract (pull values from strings) and top / order by (sort). Always filter on TimeGenerated early; it is the cheapest filter and keeps queries inside quota.

  • == is case-sensitive; =~ is case-insensitive.
  • has matches whole terms and is much faster than contains, which matches substrings.
  • KQL join defaults to innerunique, which deduplicates the left side. Specify kind=inner when you need every match.

How it works: KQL & SPL Query Builder

KQL & SPL Query Builder KQL and Splunk SPL Threat Hunting Query & Security Architecture Diagram. Diagram of the query builder: visual filter rows form a query syntax tree that emits a Microsoft Sentinel KQL query and an equivalent Splunk SPL query, with a Rosetta table mapping where to search, summarize to stats and project to table.
Diagram of the query builder: visual filter rows form a query syntax tree that emits a Microsoft Sentinel KQL query and an equivalent Splunk SPL query, with a Rosetta table mapping where to search, summarize to stats and project to table.

Splunk SPL basics

The Splunk query language (SPL) starts with a search over indexed events, written as index=… sourcetype=… field=value, and pipes the results through commands: stats, eval, table, rex, where, dedup, timechart and lookup. The implicit search at the start is the fastest place to filter, because it uses the index.

Splunk regex extraction uses rex: | rex field=_raw "user=(?<user>\S+)" creates a user field. In Splunk regex, named groups use (?<name>…), and backslashes inside quotes must be escaped once more than in a raw pattern.

Translating detections between SPL and KQL

Most Splunk SPL detections translate one command at a time. stats count by user becomes summarize count() by user; eval becomes extend; table becomes project; rex becomes parse or extract(); earliest=-24h becomes where TimeGenerated > ago(24h). Field names usually differ more than syntax does. Windows logon events are EventCode in Splunk’s Windows TA but EventID in Sentinel’s SecurityEvent table.

The builder keeps one filter model and emits both dialects, so you can check that a translated detection still uses the same logic. Review the field mapping for your data sources before deploying.

Using the SOC hunting presets

Each preset is a hunting starting point, not a production analytic rule. Run it over a recent window, baseline what is normal for your environment, then add allow-lists and thresholds before alerting on it. The presets are mapped to MITRE ATT&CK techniques so you can track coverage. They are also concrete Splunk query examples and KQL query examples for training new analysts.

SPL to KQL Rosetta Stone

Equivalent commands in Splunk SPL and Microsoft Sentinel KQL.
Splunk SPLKQLPurpose
search / implicitwhereFilter rows
stats count by xsummarize count() by xAggregate
eval y=…extend y = …Computed column
table a, bproject a, bChoose columns
rename a AS bproject-rename b = aRename a column
rex "(?<u>\S+)"parse / extract()Regex field extraction
dedup xsummarize arg_max(TimeGenerated, *) by xLatest row per key
sort - countorder by count descSort
head 10take 10Limit rows
top 10 xtop 10 by count_Most frequent values
timechart span=1h countsummarize count() by bin(TimeGenerated, 1h)Time series
earliest=-24hwhere TimeGenerated > ago(24h)Time range
join type=inner xjoin kind=inner (…) on xJoin
stats dc(x) by ysummarize dcount(x) by yKQL summarize: distinct count
join type=left xjoin kind=leftouter (…) on xKusto join: keep unmatched left rows
NOT [search … | fields x]join kind=leftanti (…) on xKusto join: left rows with no match
x="*text*"where x has "text" / containsKQL contains (has is faster, whole terms)
regex x="pat"where x matches regex @"pat"KQL regex filter
rex field=x "(?<u>\S+)"extend u = extract(@"(\S+)", 1, x)KQL regex extract
(Loki) | regexp `(?P<u>\S+)`parse / extract()LogQL regex extract → label
lookup file.csv xjoin (_GetWatchlist("x")) on xEnrichment

Equivalent commands in Splunk SPL and Microsoft Sentinel KQL.

Command-line examples

Run KQL from the Azure CLI

az monitor log-analytics query -w $WORKSPACE_ID --analytics-query "SecurityEvent | where EventID == 4625 | take 10"

Run SPL from the Splunk CLI

splunk search "index=wineventlog EventCode=4625 | stats count by Account_Name" -earliest_time -24h

Run SPL over the REST API

curl -k -u admin https://splunk:8089/services/search/jobs/export -d search="search index=main | head 5" -d output_mode=json

Frequently asked questions

KQL (Kusto Query Language) is the language security analysts use to hunt and write detections in Microsoft Sentinel and Microsoft Defender XDR. It queries security logs such as sign-ins, process creation, network connections and alerts at scale.

Related Engineering Guides