Lesson238 words

Kusto Query Language

Interrogate logs using basic Kusto Query Language queries

The shape

A KQL query starts with a table and pipes it through operators:

kusto
requests | where timestamp > ago(24h) | where success == false | summarize failures = count() by name, bin(timestamp, 1h) | order by failures desc | take 20

Read it top to bottom: source → filter → aggregate → order → limit. Recognising that shape matters more than memorising operators, because almost every practical query follows it.

The operators worth knowing

OperatorDoes
whereFilter rows
summarizeAggregate — count(), avg(), percentile()
bin()Bucket a timestamp into intervals, for time series
projectChoose columns
extendAdd a calculated column
joinCombine tables
order by / takeSort and limit

Filter early

Put where as close to the source as possible. Filtering before aggregating reduces the data scanned, which matters for both speed and cost on a large workspace — and a time filter is nearly always the most valuable one.

Percentiles

kusto
requests | summarize p95 = percentile(duration, 95), p99 = percentile(duration, 99) by name

This is the query behind the earlier point that averages hide the tail. Reporting p95 and p99 by operation is the standard latency view.

Primary sources

Ready to study Designing and Implementing Microsoft DevOps Solutions (AZ-400)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free