Domain 4 of 4 · Chapter 4 of 4

Analyze logs and metrics with KQL

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing Developing AI Cloud Solutions on Azure premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • Where writing telemetry ends and reading it begins
  • Two published schemas over one set of rows
  • Group, bucket, or series: choosing the aggregation
  • Correlating tables on the operation ID
  • Why predicate order is a performance decision
  • Five bounds that all feel like "how much data"
  • Counting rows versus counting what happened
  • The two triage columns, and how each one misleads
  • Queries about the platform, not the application
  • Telling the traps apart

Three aggregations that sound alike and return different shapes

Question you are answeringsummarize … by <dimension>summarize … by bin(<time>, <step>)make-series … on <time> step <step>
Result shapeOne row per groupOne row per group per intervalOne row per group; each aggregate column is an array
Intervals with no matching rowsNot applicableNo row is produced, so the gap is invisibleAn element is still produced, holding the declared default (0 unless you set one)
Getting back to one row per pointAlready one row per groupAlready one row per pointExpand the arrays with mv-expand
Usable by the series interpolation functionsNoNoYes, and only where the default is double(null)
Typical questionWhich result codes are driving the failuresWhen did the spike startWhat does the whole window look like, idle intervals included

Decision tree

what shape must the answer have?rows from one tablechoose by result shaperows from more than one tablechoose by how they combinesummarize byone row per groupno time axissummarize by bin()one point per intervalempty interval: no rowmake-seriesan element per intervaldefault decides the gapsjoin on OperationIdcolumns from bothtime-filter each sideunionrows stackedno matching performedrender is not a branch: it annotates whichever result you produced, and always goes last

Cheat sheet

  • KQL chains tabular operators with the pipe, each transforming the previous result
  • summarize with a by clause groups rows and computes aggregates per group
  • A TimeGenerated filter in the query sets the Log Analytics time range - unless the source is a classic app(), where both windows apply
  • On a Basic or Auxiliary table the query is limited to one table - join, find, search and externaldata are unavailable
  • A log query is capped at 500,000 records, ~100 MB and 10 minutes, and a multi-region scope is warned then blocked
  • Kusto's datetime and term indexes dictate the order of where predicates and the choice of has over contains
  • Application Insights exposes one table per telemetry type, and which of them fill depends on how the app is instrumented
  • join and union correlate rows across telemetry tables
  • Application Insights tables keep ninety days for free while the rest of the workspace keeps thirty
  • A custom metric is stored twice, and the two copies do not carry the same dimensions
  • bin() buckets timestamps into intervals so summarize can build a time series
  • ago() and datetime comparisons scope a query to a time range
  • make-series returns gap-free arrays because empty intervals take the declared default
  • render timechart demands a leading datetime column and splits lines on a string column
  • Failed-request triage filters requests by success and groups by result code
  • Slow-dependency triage aggregates dependency duration, including tail latency

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. Get started with log queries in Azure Monitor Logs
  2. Log query scope in Azure Monitor Log Analytics
  3. Application Insights telemetry data model
  4. Azure Monitor Logs reference: AppRequests
  5. Azure Monitor Logs reference: AppSystemEvents
  6. Example log table queries for AppRequests
  7. make-series operator
  8. render operator
  9. Optimize log queries in Azure Monitor
  10. Best practices for Kusto Query Language queries
  11. Azure Monitor service limits
  12. Query data in a Basic and Auxiliary table in Azure Monitor Logs
  13. Manage data retention in a Log Analytics workspace
  14. Metrics in Application Insights
  15. Azure Monitor OpenTelemetry Distro for Python (client library README)
  16. Configure Azure Monitor OpenTelemetry
  17. Monitor Azure App Configuration
  18. Azure Monitor Logs reference: AzureActivity
  19. Monitor Azure Key Vault
  20. Azure Key Vault logging