Query Details
let _AuxiliaryTables = dynamic([
"OfficeActivity", "AzureActivity", "Heartbeat",
"SentinelHealth", "SecurityAlert", "SecurityIncident", "Operation"
]);
let _SpikeMultiplier = 3.0;
let _MinDailyMB = 10;
let _Baseline =
Usage
| where TimeGenerated between (ago(15d) .. ago(1d))
| where IsBillable == true
| where DataType !in (_AuxiliaryTables)
| summarize DailyMB = sum(Quantity) by Day = bin(TimeGenerated, 1d), DataType
| summarize AvgDailyMB = avg(DailyMB) by DataType
| where AvgDailyMB > _MinDailyMB;
Usage
| where TimeGenerated > ago(1d)
| where IsBillable == true
| where DataType !in (_AuxiliaryTables)
| summarize TodayMB = sum(Quantity) by DataType
| join kind=inner _Baseline on DataType
| where TodayMB > (AvgDailyMB * _SpikeMultiplier)
| extend
SpikeMultiplier = round(TodayMB / AvgDailyMB, 1),
ExcessMB = round(TodayMB - AvgDailyMB, 1),
ExcessGB = round((TodayMB - AvgDailyMB) / 1024.0, 3),
EstExcessCostUSD = round(((TodayMB - AvgDailyMB) / 1024.0) * 2.76, 2)
| project
TimeGenerated = now(),
DataType,
TodayMB = round(TodayMB, 1),
AvgDailyMB = round(AvgDailyMB, 1),
SpikeMultiplier, ExcessMB, ExcessGB, EstExcessCostUSD
| order by SpikeMultiplier desc
This KQL query is designed to identify unusual spikes in data usage for specific data types over the past day, excluding certain auxiliary tables. Here's a simplified breakdown of what the query does:
Setup and Definitions:
_AuxiliaryTables) that should be excluded from the analysis._SpikeMultiplier) of 3.0 to identify significant increases in data usage._MinDailyMB) of 10 MB to filter out data types with very low usage.Baseline Calculation:
AvgDailyMB) for each data type over the past 14 days (from 15 days ago to 1 day ago), excluding the auxiliary tables and only considering billable data.Current Day Analysis:
TodayMB) for each data type in the last day, again excluding auxiliary tables and only considering billable data.Spike Detection:
AvgDailyMB * _SpikeMultiplier).Output:
In summary, this query helps to detect and quantify significant increases in data usage for specific data types over the past day, potentially indicating unusual or unexpected activity.

David Alonso
Released: April 8, 2026
Tables
Keywords
Operators