Skip to content

Commit 1a5395b

Browse files
authored
Merge pull request #250848 from guywi-ms/patch-70
Update azure-monitor-data-explorer-proxy.md
2 parents f66f3c1 + adf55aa commit 1a5395b

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

articles/azure-monitor/logs/azure-monitor-data-explorer-proxy.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ union customEvents, adx('https://help.kusto.windows.net/Samples').StormEvents
5151
```kusto
5252
let CL1 = adx('https://help.kusto.windows.net/Samples').StormEvents;
5353
union customEvents, CL1 | take 10
54-
55-
```sql
54+
```
5655

5756
> [!TIP]
5857
> Shorthand format is allowed: *ClusterName*/*InitialCatalog*. For example, `adx('help/Samples')` is translated to `adx('help.kusto.windows.net/Samples')`.
@@ -61,7 +60,7 @@ When you use the [`join` operator](/azure/data-explorer/kusto/query/joinoperator
6160

6261
For example:
6362

64-
kusto
63+
```kusto
6564
AzureDiagnostics
6665
| join hint.remote=left adx("cluster=ClusterURI").AzureDiagnostics on (ColumnName)
6766
```
@@ -95,40 +94,39 @@ Here are some sample Azure Log Analytics queries that use the new Azure Resource
9594

9695
- Filter a Log Analytics query based on the results of an Azure Resource Graph query:
9796

98-
```kusto
99-
arg("").Resources
100-
| where type == "microsoft.compute/virtualmachines" and properties.hardwareProfile.vmSize startswith "Standard_D"
101-
| join (
102-
Heartbeat
103-
| where TimeGenerated > ago(1d)
104-
| distinct Computer
105-
)
106-
on $left.name == $right.Computer
107-
```
97+
```kusto
98+
arg("").Resources
99+
| where type == "microsoft.compute/virtualmachines" and properties.hardwareProfile.vmSize startswith "Standard_D"
100+
| join (
101+
Heartbeat
102+
| where TimeGenerated > ago(1d)
103+
| distinct Computer
104+
)
105+
on $left.name == $right.Computer
106+
```
108107
109108
- Create an alert rule that applies only to certain resources taken from an ARG query:
110109
- Exclude resources based on tags – for example, not to trigger alerts for VMs with a “Test” tag.
111110
112-
```kusto
113-
arg("").Resources
114-
| where tags.environment=~'Test'
115-
| project name
116-
117-
```
118-
119-
- Retrieve performance data related to CPU utilization and filter to resources with the “prod” tag.
120-
121-
```kusto
122-
InsightsMetrics
123-
| where Name == "UtilizationPercentage"
124-
| lookup (
125-
arg("").Resources
126-
| where type == 'microsoft.compute/virtualmachines'
127-
| project _ResourceId=tolower(id), tags
128-
)
129-
on _ResourceId
130-
| where tostring(tags.Env) == "Prod"
131-
```
111+
```kusto
112+
arg("").Resources
113+
| where tags.environment=~'Test'
114+
| project name
115+
```
116+
117+
- Retrieve performance data related to CPU utilization and filter to resources with the “prod” tag.
118+
119+
```kusto
120+
InsightsMetrics
121+
| where Name == "UtilizationPercentage"
122+
| lookup (
123+
arg("").Resources
124+
| where type == 'microsoft.compute/virtualmachines'
125+
| project _ResourceId=tolower(id), tags
126+
)
127+
on _ResourceId
128+
| where tostring(tags.Env) == "Prod"
129+
```
132130
133131
More use cases:
134132
- Use a tag to determine whether VMs should be running 24x7 or should be shut down at night.
@@ -147,16 +145,14 @@ union AzureActivity, arg("").Resources
147145
```kusto
148146
let CL1 = arg("").Resources ;
149147
union AzureActivity, CL1 | take 10
148+
```
150149

151-
```sql
152-
153-
When you use the [`join` operator](/azure/data-explorer/kusto/query/joinoperator) instead of union, you're required to use a [`hint`](/azure/data-explorer/kusto/query/joinoperator#join-hints) to combine the data in Azure Resource Graph with the Log Analytics workspace. Use `Hint.remote={Direction of the Log Analytics Workspace}`. For example:
150+
When you use the [`join` operator](/azure/data-explorer/kusto/query/joinoperator) instead of union, you need to use a [`hint`](/azure/data-explorer/kusto/query/joinoperator#join-hints) to combine the data in Azure Resource Graph with data in the Log Analytics workspace. Use `Hint.remote={Direction of the Log Analytics Workspace}`. For example:
154151

155-
kusto
152+
```kusto
156153
Perf | where ObjectName == "Memory" and (CounterName == "Available MBytes Memory")
157154
| extend _ResourceId = replace_string(replace_string(replace_string(_ResourceId, 'microsoft.compute', 'Microsoft.Compute'), 'virtualmachines','virtualMachines'),"resourcegroups","resourceGroups")
158155
| join hint.remote=left (arg("").Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project _ResourceId=id, tags) on _ResourceId | project-away _ResourceId1 | where tostring(tags.env) == "prod"
159-
160156
```
161157

162158
## Create an alert based on a cross-service query

0 commit comments

Comments
 (0)