Skip to content

Commit 5d999aa

Browse files
authored
Merge pull request #107894 from bwren/am-manage-cost-storage
Azure Monitor manage cost storage update
2 parents a24e58b + c0295bb commit 5d999aa

File tree

2 files changed

+79
-48
lines changed

2 files changed

+79
-48
lines changed

articles/azure-monitor/log-query/examples.md

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.subservice: logs
55
ms.topic: conceptual
66
author: bwren
77
ms.author: bwren
8-
ms.date: 10/01/2019
8+
ms.date: 03/16/2020
99

1010
---
1111

@@ -349,12 +349,12 @@ Using **join**, and **let** statements we can check if the same suspicious accou
349349
```Kusto
350350
let timeframe = 1d;
351351
let suspicious_users =
352-
SecurityEvent
353-
| where TimeGenerated > ago(timeframe)
354-
| where AccountType == 'User' and EventID == 4625 // 4625 - failed login
355-
| summarize failed_login_attempts=count(), latest_failed_login=arg_max(TimeGenerated, Account) by Account
356-
| where failed_login_attempts > 5
357-
| project-away Account1;
352+
SecurityEvent
353+
| where TimeGenerated > ago(timeframe)
354+
| where AccountType == 'User' and EventID == 4625 // 4625 - failed login
355+
| summarize failed_login_attempts=count(), latest_failed_login=arg_max(TimeGenerated, Account) by Account
356+
| where failed_login_attempts > 5
357+
| project-away Account1;
358358
let suspicious_users_that_later_logged_in =
359359
suspicious_users
360360
| join kind=innerunique (
@@ -371,41 +371,49 @@ suspicious_users_that_later_logged_in
371371

372372
## Usage
373373

374-
### Calculate the average size of perf usage reports per computer
374+
The `Usage` data type can be used to track the ingested data volume by solution or data type. There are other techniques to study ingested data volumes by [computer](https://docs.microsoft.com/azure/azure-monitor/platform/manage-cost-storage#data-volume-by-computer) or [Azure subscription, resource group or resource](https://docs.microsoft.com/azure/azure-monitor/platform/manage-cost-storage#data-volume-by-azure-resource-resource-group-or-subscription).
375375

376-
This example calculates the average size of perf usage reports per computer, over the last 3 hours.
377-
The results are shown in a bar chart.
378-
```Kusto
376+
#### Data volume by solution
377+
378+
The query used to view the billable data volume by solution over the last month (excluding the last partial day) is:
379+
380+
```kusto
379381
Usage
380-
| where TimeGenerated > ago(3h)
381-
| where DataType == "Perf"
382-
| where QuantityUnit == "MBytes"
383-
| summarize avg(Quantity) by Computer
384-
| sort by avg_Quantity desc nulls last
385-
| render barchart
382+
| where TimeGenerated > ago(32d)
383+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
384+
| where IsBillable == true
385+
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(StartTime, 1d), Solution | render barchart
386386
```
387387

388-
### Timechart latency percentiles 50 and 95
388+
Note that the clause `where IsBillable = true` filters out data types from certain solutions for which there is no ingestion charge. Also the clause with `TimeGenerated` is only to ensure that the query experience in the Azure portal will look back beyond the default 24 hours. When using the Usage data type, `StartTime` and `EndTime` represent the time buckets for which results are presented.
389389

390-
This example calculates and charts the 50th and 95th percentiles of reported **avgLatency** by hour over the last 24 hours.
390+
#### Data volume by type
391391

392-
```Kusto
393-
Usage
394-
| where TimeGenerated > ago(24h)
395-
| summarize percentiles(AvgLatencyInSeconds, 50, 95) by bin(TimeGenerated, 1h)
396-
| render timechart
392+
You can drill in further to see data trends for by data type:
393+
394+
```kusto
395+
Usage
396+
| where TimeGenerated > ago(32d)
397+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
398+
| where IsBillable == true
399+
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(StartTime, 1d), DataType | render barchart
397400
```
398401

399-
### Usage of specific computers today
400-
This example retrieves **Usage** data from the last day for computer names that contains the string _ContosoFile_. The results are sorted by **TimeGenerated**.
402+
Or to see a table by solution and type for the last month,
401403

402-
```Kusto
403-
Usage
404-
| where TimeGenerated > ago(1d)
405-
| where Computer contains "ContosoFile"
406-
| sort by TimeGenerated desc nulls last
404+
```kusto
405+
Usage
406+
| where TimeGenerated > ago(32d)
407+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
408+
| where IsBillable == true
409+
| summarize BillableDataGB = sum(Quantity) / 1000. by Solution, DataType
410+
| sort by Solution asc, DataType asc
407411
```
408412

413+
> [!NOTE]
414+
> Some of the fields of the Usage data type, while still in the schema, have been deprecated and will their values are no longer populated.
415+
> These are **Computer** as well as fields related to ingestion (**TotalBatches**, **BatchesWithinSla**, **BatchesOutsideSla**, **BatchesCapped** and **AverageProcessingTimeMs**.
416+
409417
## Updates
410418

411419
### Computers Still Missing Updates
@@ -427,4 +435,4 @@ Update
427435
## Next steps
428436

429437
- Refer to the [Kusto language reference](/azure/kusto/query) for details on the language.
430-
- Walk through a [lesson on writing log queries in Azure Monitor](get-started-queries.md).
438+
- Walk through a [lesson on writing log queries in Azure Monitor](get-started-queries.md).

articles/azure-monitor/platform/manage-cost-storage.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.service: azure-monitor
1111
ms.workload: na
1212
ms.tgt_pltfrm: na
1313
ms.topic: conceptual
14-
ms.date: 11/05/2019
14+
ms.date: 03/16/2020
1515
ms.author: bwren
1616
ms.subservice:
1717
---
@@ -107,7 +107,7 @@ To set the default retention for your workspace,
107107
3. On the pane, move the slider to increase or decrease the number of days and then click **OK**. If you are on the *free* tier, you will not be able to modify the data retention period and you need to upgrade to the paid tier in order to control this setting.
108108

109109
![Change workspace data retention setting](media/manage-cost-storage/manage-cost-change-retention-01.png)
110-
110+
111111
The retention can also be [set via Azure Resource Manager](https://docs.microsoft.com/azure/azure-monitor/platform/template-workspace-configuration#configure-a-log-analytics-workspace) using the `retentionInDays` parameter. Additionally, if you set the data retention to 30 days, you can trigger an immediate purge of older data using the `immediatePurgeDataOn30Days` parameter, which may be useful for compliance-related scenarios. This functionality is only exposed via Azure Resource Manager.
112112

113113
Two data types -- `Usage` and `AzureActivity` -- are retained for 90 days by default, and there is no charge for for this 90 day retention. These data types are also free from data ingestion charges.
@@ -137,9 +137,9 @@ To set the retention of a particular data type (in this example SecurityEvent) t
137137
```JSON
138138
PUT /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/MyResourceGroupName/providers/Microsoft.OperationalInsights/workspaces/MyWorkspaceName/Tables/SecurityEvent?api-version=2017-04-26-preview
139139
{
140-
"properties":
141-
{
142-
"retentionInDays": 730
140+
"properties":
141+
{
142+
"retentionInDays": 730
143143
}
144144
}
145145
```
@@ -169,15 +169,15 @@ When the daily limit is reached, the collection of billable data types stops for
169169
170170
### Identify what daily data limit to define
171171

172-
Review [Log Analytics Usage and estimated costs](usage-estimated-costs.md) to understand the data ingestion trend and what is the daily volume cap to define. It should be considered with care, since you wont be able to monitor your resources after the limit is reached.
172+
Review [Log Analytics Usage and estimated costs](usage-estimated-costs.md) to understand the data ingestion trend and what is the daily volume cap to define. It should be considered with care, since you wont be able to monitor your resources after the limit is reached.
173173

174174
### Set the Daily Cap
175175

176176
The following steps describe how to configure a limit to manage the volume of data that Log Analytics workspace will ingest per day.
177177

178178
1. From your workspace, select **Usage and estimated costs** from the left pane.
179179
2. On the **Usage and estimated costs** page for the selected workspace, click **Data volume management** from the top of the page.
180-
3. Daily cap is **OFF** by default click **ON** to enable it, and then set the data volume limit in GB/day.
180+
3. Daily cap is **OFF** by default click **ON** to enable it, and then set the data volume limit in GB/day.
181181

182182
![Log Analytics configure data limit](media/manage-cost-storage/set-daily-volume-cap-01.png)
183183

@@ -217,10 +217,11 @@ Heartbeat
217217
| summarize nodes = dcount(Computer) by bin(TimeGenerated, 1d)
218218
| render timechart
219219
```
220-
The get a count of nodes sending data seen can be determined using:
220+
The get a count of nodes sending data in the last 24 hours use the query:
221221

222222
```kusto
223223
union withsource = tt *
224+
| where TimeGenerated > ago(24h)
224225
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
225226
| where computerName != ""
226227
| summarize nodes = dcount(computerName)
@@ -230,6 +231,7 @@ To get a list of nodes sending any data (and the amount of data sent by each) th
230231

231232
```kusto
232233
union withsource = tt *
234+
| where TimeGenerated > ago(24h)
233235
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
234236
| where computerName != ""
235237
| summarize TotalVolumeBytes=sum(_BilledSize) by computerName
@@ -242,35 +244,52 @@ union withsource = tt *
242244

243245
On the **Usage and Estimated Costs** page, the *Data ingestion per solution* chart shows the total volume of data sent and how much is being sent by each solution. This allows you to determine trends such as whether the overall data usage (or usage by a particular solution) is growing, remaining steady or decreasing.
244246

247+
### Data volume for specific events
248+
249+
To look at the size of ingested data for a particular set of events, you can query the specific table (in this example `Event`) and then restrict the query to the events of interest (in this example event ID 5145 or 5156):
250+
251+
```kusto
252+
Event
253+
| where TimeGenerated > startofday(ago(31d)) and TimeGenerated < startofday(now())
254+
| where EventID == 5145 or EventID == 5156
255+
| where _IsBillable == true
256+
| summarize count(), Bytes=sum(_BilledSize) by EventID, bin(TimeGenerated, 1d)
257+
```
258+
259+
Note that the clause `where IsBillable = true` filters out data types from certain solutions for which there is no ingestion charge.
260+
245261
### Data volume by solution
246262

247-
The query used to view the billable data volume by solution is
263+
The query used to view the billable data volume by solution over the last month (excluding the last partial day) is:
248264

249265
```kusto
250266
Usage
251-
| where TimeGenerated > startofday(ago(31d))
267+
| where TimeGenerated > ago(32d)
268+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
252269
| where IsBillable == true
253-
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(TimeGenerated, 1d), Solution | render barchart
270+
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(StartTime, 1d), Solution | render barchart
254271
```
255272

256-
Note that the clause `where IsBillable = true` filters out data types from certain solutions for which there is no ingestion charge.
273+
The clause with `TimeGenerated` is only to ensure that the query experience in the Azure portal will look back beyond the default 24 hours. When using the Usage data type, `StartTime` and `EndTime` represent the time buckets for which results are presented.
257274

258275
### Data volume by type
259276

260277
You can drill in further to see data trends for by data type:
261278

262279
```kusto
263-
Usage | where TimeGenerated > startofday(ago(31d))| where IsBillable == true
264-
| where TimeGenerated > startofday(ago(31d))
280+
Usage
281+
| where TimeGenerated > ago(32d)
282+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
265283
| where IsBillable == true
266-
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(TimeGenerated, 1d), DataType | render barchart
284+
| summarize BillableDataGB = sum(Quantity) / 1000. by bin(StartTime, 1d), DataType | render barchart
267285
```
268286

269287
Or to see a table by solution and type for the last month,
270288

271289
```kusto
272290
Usage
273-
| where TimeGenerated > startofday(ago(31d))
291+
| where TimeGenerated > ago(32d)
292+
| where StartTime >= startofday(ago(31d)) and EndTime < startofday(now())
274293
| where IsBillable == true
275294
| summarize BillableDataGB = sum(Quantity) by Solution, DataType
276295
| sort by Solution asc, DataType asc
@@ -282,6 +301,7 @@ The `Usage` data type does not include information at the completer level. To se
282301

283302
```kusto
284303
union withsource = tt *
304+
| where TimeGenerated > ago(24h)
285305
| where _IsBillable == true
286306
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
287307
| summarize BillableDataBytes = sum(_BilledSize) by computerName | sort by Bytes nulls last
@@ -293,6 +313,7 @@ To see the **count** of billable events ingested per computer, use
293313

294314
```kusto
295315
union withsource = tt *
316+
| where TimeGenerated > ago(24h)
296317
| where _IsBillable == true
297318
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
298319
| summarize eventCount = count() by computerName | sort by eventCount nulls last
@@ -304,6 +325,7 @@ For data from nodes hosted in Azure you can get the **size** of ingested data __
304325

305326
```kusto
306327
union withsource = tt *
328+
| where TimeGenerated > ago(24h)
307329
| where _IsBillable == true
308330
| summarize BillableDataBytes = sum(_BilledSize) by _ResourceId | sort by Bytes nulls last
309331
```
@@ -312,6 +334,7 @@ For data from nodes hosted in Azure you can get the **size** of ingested data __
312334

313335
```kusto
314336
union withsource = tt *
337+
| where TimeGenerated > ago(24h)
315338
| where _IsBillable == true
316339
| parse tolower(_ResourceId) with "/subscriptions/" subscriptionId "/resourcegroups/"
317340
resourceGroup "/providers/" provider "/" resourceType "/" resourceName

0 commit comments

Comments
 (0)