Skip to content

Commit fd2bb66

Browse files
committed
Adding workbooks content
1 parent 8ddecdd commit fd2bb66

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

articles/azure-monitor/visualize/workbooks-create-workbook.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,52 @@ To add a query to an Azure Workbook:
125125
```
126126
127127
In this case, the query returns no rows if the **AzureDiagnostics** table is missing, or if the **ResourceId** column is missing from the table.
128+
129+
### Tutorial - resource centric logs queries in workbooks
130+
131+
This video shows you how to use resource level logs queries in Azure Workbooks. It also has tips and tricks on how to enable advanced scenarios and improve performance.
132+
133+
[![Making resource centric log queries in workbooks](https://img.youtube.com/vi/8CvjM0VvOA8/0.jpg)](https://youtu.be/8CvjM0VvOA8 "Video showing how to make resource centric log queries in workbooks")
134+
135+
#### Dynamic resource type parameter
136+
Uses dynamic scopes for more efficient querying. The snippet below uses this heuristc:
137+
1. _Individual resources_: if the count of selected resource is less than or equal to 5
138+
2. _Resource groups_: if the number of resources is over 5 but the number of resource groups the resources belong to is less than or equal to 3
139+
3. _Subscriptions_: otherwise
140+
141+
```
142+
Resources
143+
| take 1
144+
| project x = dynamic(["microsoft.compute/virtualmachines", "microsoft.compute/virtualmachinescalesets", "microsoft.resources/resourcegroups", "microsoft.resources/subscriptions"])
145+
| mvexpand x to typeof(string)
146+
| extend jkey = 1
147+
| join kind = inner (Resources
148+
| where id in~ ({VirtualMachines})
149+
| summarize Subs = dcount(subscriptionId), resourceGroups = dcount(resourceGroup), resourceCount = count()
150+
| extend jkey = 1) on jkey
151+
| project x, label = 'x',
152+
selected = case(
153+
x in ('microsoft.compute/virtualmachinescalesets', 'microsoft.compute/virtualmachines') and resourceCount <= 5, true,
154+
x == 'microsoft.resources/resourcegroups' and resourceGroups <= 3 and resourceCount > 5, true,
155+
x == 'microsoft.resources/subscriptions' and resourceGroups > 3 and resourceCount > 5, true,
156+
false)
157+
```
158+
#### Static resource scope for querying multiple resource types
159+
```json
160+
[
161+
{ "value":"microsoft.compute/virtualmachines", "label":"Virtual machine", "selected":true },
162+
{ "value":"microsoft.compute/virtualmachinescaleset", "label":"Virtual machine scale set", "selected":true }
163+
]
164+
```
165+
#### Resource parameter grouped by resource type
166+
```
167+
Resources
168+
| where type =~ 'microsoft.compute/virtualmachines' or type =~ 'microsoft.compute/virtualmachinescalesets'
169+
| where resourceGroup in~({ResourceGroups})
170+
| project value = id, label = id, selected = false,
171+
group = iff(type =~ 'microsoft.compute/virtualmachines', 'Virtual machines', 'Virtual machine scale sets')
172+
```
173+
128174
## Add parameters
129175

130176
You can collect input from consumers and reference it in other parts of the workbook using parameters. Use parameters to scope the result set or to set the right visual. Parameters help you build interactive reports and experiences. For more information on how parameters can be used, see [workbook parameters](workbooks-parameters.md).

articles/azure-monitor/visualize/workbooks-data-sources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ See also: [Log Analytics query optimization tips](../logs/query-optimization.md)
4343

4444
See also: [Workbooks best practices and hints for logs queries](workbooks-create-workbook.md#best-practices-for-querying-logs)
4545

46-
Tutorial: Making resource centric log queries in workbooks
46+
Tutorial: [Making resource centric log queries in workbooks](workbooks-create-workbook.md#tutorial---resource-centric-logs-queries-in-workbooks)
4747

4848
## Metrics
4949

0 commit comments

Comments
 (0)