Worked examples
Worked examples
Queries that answer questions you will actually be asked.
Each of these is copy-paste ready against a dataset with the usual HTTP fields. Adjust the dataset name and go.
What is broken right now?
LSQL
read top to bottom
1['api-gateway-prod']2| where _time > ago(15m)3| summarize requests = count(), errors = countif(status >= 500) by service4| extend error_rate = round(100.0 * errors / requests, 2)5| where errors > 06| order by error_rate descThe slowest endpoint, with context
LSQL
read top to bottom
1['api-gateway-prod']2| where _time > ago(1h)3| summarize p95 = percentile(latency, 95), calls = count() by route4| where calls > 505| order by p95 desc6| take 10Did the deploy make it worse?
LSQL
read top to bottom
1['api-gateway-prod']2| where _time > ago(2h)3| extend window = iff(_time < ago(1h), "before", "after")4| summarize p95 = percentile(latency, 95), errors = countif(status >= 500) by service, window5| order by service asc, window ascWhich service is costing me the most?
LSQL
read top to bottom
1['api-gateway-prod']2| where _time > ago(7d)3| summarize events = count(), bytes = sum(estimate_size()) by service4| extend share = round(100.0 * bytes / toscalar(sum(bytes)), 1)5| order by bytes descFollow one request across services
LSQL
read top to bottom
1['api-gateway-prod']2| where ['trace.id'] == "7b2d93c3ab4c2f10"3| project _time, service, route, status, latency, message4| order by _time ascErrors we have never seen before
LSQL
read top to bottom
1['api-gateway-prod']2| where _time > ago(1h) and status >= 5003| summarize seen_now = count() by message4| join kind=leftanti (5 ['api-gateway-prod']6 | where _time between (ago(30d) .. ago(1h)) and status >= 5007 | distinct message8 ) on message9| order by seen_now descSave the ones you re-run