Skip to content

Instantly share code, notes, and snippets.

@s4parke
Created July 30, 2022 02:17
Show Gist options
  • Save s4parke/25a69a90738d3f9738bbd510929897e2 to your computer and use it in GitHub Desktop.
Save s4parke/25a69a90738d3f9738bbd510929897e2 to your computer and use it in GitHub Desktop.
Kusto query for table size, number of entries, isBillable, recency in AZ log analytics
union withsource=TableName1 *
| where TimeGenerated > ago(30d)
| summarize
Entries = count(),
Size = sum(_BilledSize),
last_log = datetime_diff("second", now(), max(TimeGenerated)),
estimate = sumif(_BilledSize, _IsBillable == true)
by TableName1, _IsBillable
| project
['Table Name'] = TableName1,
['Table Entries'] = Entries,
['Table Size'] = Size,
['Size per Entry'] = 1.0 * Size / Entries,
['IsBillable'] = _IsBillable,
['Last Entry Ago (s)'] = last_log,
['Estimated Table Price'] = (estimate / (1024 * 1024 * 1024)) * 0.0
| order by ['Table Size'] desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment