Skip to content

Instantly share code, notes, and snippets.

@binura-g
Last active July 28, 2022 03:05
Show Gist options
  • Save binura-g/aab92ff1efe6179a32b2da36cf69cf07 to your computer and use it in GitHub Desktop.
Save binura-g/aab92ff1efe6179a32b2da36cf69cf07 to your computer and use it in GitHub Desktop.
Kusto AKS Example - latency percentiles with structured JSON logs
let _Namespace = "namespace_name";
let _ServiceName = "deployment_name";
KubePodInventory
| where Namespace == _Namespace
| where ContainerName has_cs _ServiceName
| distinct ContainerID
| join kind=inner ContainerLog on ContainerID
| where LogEntry has '"type":"http-access"' // filtering out only the http access logs
| extend parsedLog=parse_json(LogEntry)
| extend latencyMs=todouble(parsedLog.responseTimeMs),
method=tostring(parsedLog.method)
| summarize percentiles(latencyMs, 99, 90, 50) by method;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment