In the vast constellation of Azure services, data flows like stardust—scattered across logs, metrics, traces, and telemetry. To make sense of it all, you need more than just a query language. You need a lens. A scalpel. A symphony conductor.
This guide is your deep dive into the most essential and advanced KQL queries, including:
- 🧨 Exception and error detection
- ⚠️ Warning and informational log analysis
- 📊 Performance metrics and time-series insights
- 🔐 Security and audit trail queries
- 🧠 Advanced filtering, summarization, and pattern matching
Each query is a tool. Each pattern, a story. And each insight, a step closer to mastering the art of observability.
Absolutely, Durgesh! Here's a revised and expanded blog title along with a refined intro that reflects the broader scope of KQL queries—including exceptions, errors, warnings, info logs, performance metrics, and security insights.
exceptions
| where timestamp > ago(1d)
| summarize count() by type, method, outerType, bin(timestamp, 1h)
traces
| where severityLevel == 3 // Error
| summarize count() by message, bin(timestamp, 1h)
⚠️ Warning & Informational Logs
| where severityLevel == 2 // Warning
| summarize count() by message, bin(timestamp, 1h)
traces
| where severityLevel == 1 // Information
| summarize count() by message, bin(timestamp, 1h)
📊 Performance Monitoring
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time"
| summarize avg(CounterValue) by bin(TimeGenerated, 5m), Computer
requests
| summarize avg(duration) by bin(timestamp, 5m), name
🔐 Security & Audit Insights
| summarize FailedLogins = count() by Account, bin(TimeGenerated, 1h)
SigninLogs
| where ResultType != 0
| summarize count() by UserPrincipalName, AppDisplayName, bin(TimeGenerated, 1h)
🧠 Advanced Filtering & Case Logic
| extend severity = case(
severityLevel == 3, "Error",
severityLevel == 2, "Warning",
severityLevel == 1, "Info",
"Other")
| summarize count() by severity, bin(timestamp, 1h)
📌 Summary Table by Severity
| summarize Errors = countif(severityLevel == 3),
Warnings = countif(severityLevel == 2),
InfoLogs = countif(severityLevel == 1)
0 Comments