Last active
January 18, 2021 09:24
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original query by https://medium.com/@visnara from https://medium.com/microsoftazure/azure-monitor-for-containers-optimizing-data-collection-settings-for-cost-ce6f848aca32