Azure Sentinel for SIEM - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
We want to understand how the time to analyze security data grows as more data is collected in Azure Sentinel.
Specifically, how does the number of operations change when processing more alerts and logs?
Analyze the time complexity of querying and alerting in Azure Sentinel.
// Pseudo-azure code for Sentinel query and alert
let alerts = SecurityAlert
| where TimeGenerated > ago(1d)
| where Severity == 'High'
| summarize count() by AlertName
alerts
| where count_ > 10
| project AlertName, count_
This sequence queries high severity alerts from the last day, counts them by alert type, and filters for frequent alerts.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Querying logs from the SecurityAlert table.
- How many times: Once per query, but the query scans all alerts in the time range.
- Data aggregation: Counting alerts by type involves scanning all matching records.
As the number of alerts grows, the query scans more records, so the time grows roughly in proportion to the number of alerts.
| Input Size (n alerts) | Approx. Api Calls/Operations |
|---|---|
| 10 | Scan 10 alerts |
| 100 | Scan 100 alerts |
| 1000 | Scan 1000 alerts |
Pattern observation: The work grows linearly as the number of alerts increases.
Time Complexity: O(n)
This means the time to process alerts grows directly with the number of alerts collected.
[X] Wrong: "Querying alerts always takes the same time regardless of data size."
[OK] Correct: The query scans all matching alerts, so more alerts mean more work and longer time.
Understanding how data size affects query time in Azure Sentinel helps you design efficient security monitoring solutions.
"What if we added indexing or partitioning to the SecurityAlert table? How would the time complexity change?"
Practice
Solution
Step 1: Understand Azure Sentinel's role
Azure Sentinel is designed to collect security data from various sources to detect threats.Step 2: Compare options with Sentinel's function
Only To collect and analyze security data for threat detection describes collecting and analyzing security data for threat detection, which matches Sentinel's purpose.Final Answer:
To collect and analyze security data for threat detection -> Option BQuick Check:
Azure Sentinel = threat detection [OK]
- Confusing Sentinel with backup or storage services
- Thinking Sentinel manages passwords directly
- Assuming Sentinel is just cloud storage
Solution
Step 1: Identify the query language used in Azure Sentinel
Azure Sentinel uses Kusto Query Language (KQL), which uses pipe operators and 'where' clauses.Step 2: Match the syntax to KQL
SecurityEvent | where EventID == 4625 uses KQL syntax correctly: table name, pipe, and 'where' condition. Other options use SQL or invalid syntax.Final Answer:
SecurityEvent | where EventID == 4625 -> Option DQuick Check:
KQL uses pipes and 'where' [OK]
- Using SQL syntax instead of KQL
- Missing pipe operator in query
- Using incorrect keywords like GET or FIND
SecurityEvent | where EventID == 4625 | summarize count() by AccountWhat does this query output?
Solution
Step 1: Analyze the query filters and aggregation
The query filters SecurityEvent for EventID 4625, which means failed login attempts, then counts them grouped by Account.Step 2: Understand the summarize clause
'summarize count() by Account' groups results by Account and counts events per account.Final Answer:
A count of failed login attempts grouped by user account -> Option CQuick Check:
EventID 4625 = failed logins, grouped count = A count of failed login attempts grouped by user account [OK]
- Confusing EventID 4625 with successful logins
- Ignoring the grouping by Account
- Thinking it lists accounts without attempts
SecurityEvent | where EventID = 4625 | summarize count() by AccountWhy does this query fail to run correctly?
Solution
Step 1: Check the operator syntax in the 'where' clause
KQL requires '==' for equality comparison, not a single '=' which is assignment in some languages.Step 2: Validate other parts of the query
'summarize count() by Account' is valid, and 'Account' is a common field. 'where' must come before 'summarize'.Final Answer:
Because the equality operator should be '==' not '=' in KQL -> Option AQuick Check:
KQL equality uses '==' not '=' [OK]
- Using single '=' instead of '==' in KQL
- Misplacing 'where' after 'summarize'
- Assuming 'count()' is invalid with 'summarize'
Solution
Step 1: Filter failed login events within last 10 minutes
SecurityEvent | where EventID == 4625 | where TimeGenerated > ago(10m) | summarize FailedAttempts = count() by Account | where FailedAttempts > 5 uses 'where TimeGenerated > ago(10m)' to filter recent events correctly.Step 2: Group by Account and count attempts, then filter counts over 5
SecurityEvent | where EventID == 4625 | where TimeGenerated > ago(10m) | summarize FailedAttempts = count() by Account | where FailedAttempts > 5 summarizes counts by Account and filters where count > 5, matching the requirement.Final Answer:
SecurityEvent | where EventID == 4625 | where TimeGenerated > ago(10m) | summarize FailedAttempts = count() by Account | where FailedAttempts > 5 -> Option AQuick Check:
Filter by time + count > 5 per account = SecurityEvent | where EventID == 4625 | where TimeGenerated > ago(10m) | summarize FailedAttempts = count() by Account | where FailedAttempts > 5 [OK]
- Not filtering events by time range
- Using incorrect logical operators in filters
- Grouping by TimeGenerated causing wrong counts
