You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/logs/azure-monitor-data-explorer-proxy.md
+53-5Lines changed: 53 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ ms.author: guywild
6
6
ms.topic: conceptual
7
7
ms.date: 08/22/2023
8
8
ms.reviewer: osalzberg
9
-
10
9
---
10
+
11
11
# Query data in Azure Data Explorer and Azure Resource Graph from Azure Monitor
12
12
Azure Monitor lets you query data in [Azure Data Explorer](/azure/data-explorer/data-explorer-overview) and [Azure Resource Graph](../../governance/resource-graph/overview.md) from your Log Analytics workspace and Application Insights resources. This article explains how to query data in Azure Resource Graph and Azure Data Explorer from Azure Monitor.
13
13
@@ -51,7 +51,8 @@ union customEvents, adx('https://help.kusto.windows.net/Samples').StormEvents
51
51
```kusto
52
52
let CL1 = adx('https://help.kusto.windows.net/Samples').StormEvents;
53
53
union customEvents, CL1 | take 10
54
-
```
54
+
55
+
```sql
55
56
56
57
> [!TIP]
57
58
> Shorthand format is allowed: *ClusterName*/*InitialCatalog*. For example, `adx('help/Samples')` is translated to `adx('help.kusto.windows.net/Samples')`.
@@ -60,7 +61,7 @@ When you use the [`join` operator](/azure/data-explorer/kusto/query/joinoperator
60
61
61
62
For example:
62
63
63
-
```kusto
64
+
kusto
64
65
AzureDiagnostics
65
66
| join hint.remote=left adx("cluster=ClusterURI").AzureDiagnostics on (ColumnName)
66
67
```
@@ -90,6 +91,49 @@ For example:
90
91
arg("").<Azure-Resource-Graph-table-name>
91
92
```
92
93
94
+
Here are some sample Azure Log Analytics queries that use the new Azure Resource Graph cross-service query capabilities:
95
+
96
+
- Filter a Log Analytics query based on the results of an Azure Resource Graph query:
97
+
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
+
```
108
+
109
+
- Create an alert rule that applies only to certain resources taken from an ARG query:
110
+
- Exclude resources based on tags – for example, not to trigger alerts for VMs with a “Test” tag.
111
+
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
+
```
132
+
133
+
More use cases:
134
+
- Use a tag to determine whether VMs should be running 24x7 or should be shutdown at night.
135
+
- Show alerts on any server that contains a certain number of cores.
136
+
93
137
### Combine Azure Resource Graph tables with a Log Analytics workspace
94
138
95
139
Use the `union` command to combine cluster tables with a Log Analytics workspace.
@@ -103,14 +147,16 @@ union AzureActivity, arg("").Resources
103
147
```kusto
104
148
let CL1 = arg("").Resources ;
105
149
union AzureActivity, CL1 | take 10
106
-
```
150
+
151
+
```sql
107
152
108
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:
109
154
110
-
```kusto
155
+
kusto
111
156
Perf | where ObjectName == "Memory" and (CounterName == "Available MBytes Memory")
0 commit comments