KQL: Log Analytics ingestion volume and daily exceptions
KQL queries for billable ingestion per table and application exceptions per role and day.
Two useful Kusto (KQL) queries for a Log Analytics workspace: billable ingestion per table, and application exceptions per day.
Billable ingested volume per table and per day
The Usage table reports the billable ingested volume per data type (DataType). The first query keeps the 10 largest tables over the last 100 days, groups all other tables under Other, and computes the daily ingested volume in GB (the Quantity column, in MB, is divided by 1,000).
let TopTables = materialize(
Usage
| where TimeGenerated > startofday(ago(100d))
| where StartTime > startofday(ago(100d))
| where IsBillable
| summarize IngestedGB=sum(Quantity) / 1.0E3 by DataType
| sort by IngestedGB desc
| take 10
| project DataType);
Usage
| where TimeGenerated > startofday(ago(100d))
| where StartTime > startofday(ago(100d))
| where IsBillable
| extend Table = iff(DataType in (TopTables), DataType, "Other")
| extend Rank = iff(Table == "Other", 2, 1)
| summarize IngestedGB=sum(Quantity) / 1.0E3 by Table, bin(StartTime, 1d), Rank
| sort by Rank asc, IngestedGB desc
| project-away Rank
| project StartTime, Table, IngestedGB
| render columnchart
Application exceptions per day
Counts application exceptions (Application Insights AppExceptions table) per application role and per day over a fixed period.
AppExceptions
| where TimeGenerated between (todatetime('2024-09-01')..todatetime('2024-09-30'))
| summarize count() by AppRoleName, bin(TimeGenerated, 1d)
| render columnchart