Forum Discussion
T150732D
Jun 27, 2022Copper Contributor
Sentinel Billable data
Hello can you please help me understand difference of two queries we received from vendor deployin sentinel.
We have logic app running daily this query to see billable data (to monitor if we are reaching cap).
Usage
| where TimeGenerated > ago(1d)
| where IsBillable == true
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(TimeGenerated, 31d), Solution
| summarize TotalDataGB = sum(BillableDataGB)
Also we got the visualisation in chart over mont
Usage
|where TimeGenerated > ago (30d)
|where IsBillable == true
| summarize BillableDataGB=sum(Quantity) / 1000. by bin(TimeGenerated, 1d), Solution
| render columnchart
However often there is big difference, while the first one reports over several days numbers 300-400, when i look at the data in second I see peaks to 700 GB.
Example below. On 22June we see peak to 700GB, however the outcome of the first query was always 300-400 GB when reported
23.6. reported previous daily ingestion : 415.907715810097 GB.
22.6 reported previous daily ingestion : 367.10762928873 GB.
Does not make sense to me have such big difference.
ALSO WHAt Query for monnitoring and analyzing daily ingestion are you using please???
- Clive_WatsonBronze ContributorI tend to prefer "between" for this...but either work
| where TimeGenerated between ( startofday(ago(1d)) .. endofday(ago(1d)) )- T150732DCopper Contributor
Clive_Watson thanks for your helps.
this query you proposed returns now 550 GB
Usage | where TimeGenerated > ago(1d) | where IsBillable == true | summarize BillableDataGB = sum(Quantity) / 1000.
the second query returns now 840 GB
Usage | where TimeGenerated > startofday(ago(1d)) | where IsBillable == true | summarize BillableDataGB = sum(Quantity) / 1000.
the query mikhailf proposed
| where StartTime >= startofday(ago(1d)) and EndTime < startofday(now())
returns 485 GB
My initial query returns now 550 GB
Usage
| where TimeGenerated > ago(1d)
| where IsBillable == true
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(TimeGenerated, 31d), Solution
| summarize TotalDataGB = sum(BillableDataGB)
- Clive_WatsonBronze Contributor
For query one, you only need this KQL for the same result.
Usage | where TimeGenerated > ago(1d) | where IsBillable == true | summarize BillableDataGB = sum(Quantity) / 1000.
However you may be better off adding a time alignment, as you dont say when the Playbooks runs, and you will get different results depending on the time of day, however if you add startofday() you always get from the first record after midnight. See here for more How to align your Analytics with time windows in Azure Sentinel using KQL (Kusto Query Language) - Microsoft Tech CommunityUsage | where TimeGenerated > startofday(ago(1d)) | where IsBillable == true | summarize BillableDataGB = sum(Quantity) / 1000.
- Clive_WatsonBronze Contributorbtw, there are two articles/Playbooks from Microsoft:
https://techcommunity.microsoft.com/t5/microsoft-sentinel-blog/ingestion-cost-spike-detection-playbook/ba-p/2591301
and
https://techcommunity.microsoft.com/t5/microsoft-sentinel-blog/ingestion-cost-alert-playbook/ba-p/2006003