Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save MarkWarneke/711aa112750878843ba2f02399b4ef8a to your computer and use it in GitHub Desktop.

Select an option

Save MarkWarneke/711aa112750878843ba2f02399b4ef8a to your computer and use it in GitHub Desktop.
A Kusto query to display BillableDataMBytes by sourceNamespace as a piechart. See https://markwarneke.me/2020-07-07-K8S-Azure-Log-Analytics-Cost/
let startTime = ago(31d);
let containerLogs = ContainerLog
| where TimeGenerated > startTime
| where _IsBillable == true
| summarize BillableDataMBytes = sum(_BilledSize)/ (1000. * 1000.) by LogEntrySource, ContainerID;
let kpi = KubePodInventory
| where TimeGenerated > startTime
| distinct ContainerID, Namespace;
containerLogs
| join kpi on $left.ContainerID == $right.ContainerID
| extend sourceNamespace = strcat(LogEntrySource, "/", Namespace)
| summarize MB=sum(BillableDataMBytes) by sourceNamespace
| render piechart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment