What You'll Learn
You'll learn how to write queries in KQL (Kusto Query Language), SPL (Splunk Processing Language), and SQL-like languages to search, filter, and correlate security events from cloud logs.
Why Query Languages Matter in Cloud SIEM
A SIEM collects enormous volumes of security events—API calls, network flows, application logs, authentication attempts. To make sense of this data, you need a powerful query language that lets you slice, filter, aggregate, and correlate events rapidly. Think of it like asking very specific questions of a massive library: "Show me all failed login attempts from non-US IP addresses in the last hour where the same user succeeded within 5 minutes."
Common Cloud SIEM Query Languages
KQL (Kusto Query Language)
Used by Azure Sentinel and Azure Monitor. KQL is pipeline-based: you start with a data source and chain operations using the pipe (|) operator.
SigninLogs
| where TimeGenerated > ago(1h)
| where ResultType != "0"
| summarize FailedAttempts=count() by UserPrincipalName, IPAddress
| where FailedAttempts > 5
SPL (Splunk Processing Language)
Used by Splunk and some cloud SIEM platforms. Also pipeline-based, uses | to chain commands.
index=cloudtrail eventName=ConsoleLogin errorCode=*
| stats count by sourceIPAddress, userIdentity.userName
| where count > 10
SQL-Like Languages
Platforms like AWS Athena or Google BigQuery let you query logs using familiar SQL syntax.
SELECT userIdentity.userName, COUNT(*) as attempts
FROM cloudtrail_logs
WHERE eventTime > CURRENT_TIMESTAMP - INTERVAL '1 hour'
AND errorCode IS NOT NULL
GROUP BY userIdentity.userName
HAVING attempts > 5
Core Operations
All three languages support:
- Filtering (
where,WHERE) – narrow down events - Aggregation (
summarize,stats,GROUP BY) – count, sum, or group - Time-based search (
ago(), time ranges) – focus on recent events - Joins and correlation – link events across different log sources
Key Takeaway: Mastering SIEM query languages (KQL, SPL, or SQL) lets you quickly hunt threats, investigate incidents, and build correlation rules across massive cloud log datasets.