Skip to content

Commit 1269bd5

Browse files
Merge pull request #239597 from yossi-y/main
Cross query updates
2 parents f5a8748 + 3755034 commit 1269bd5

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Optimize log alert queries | Microsoft Docs
33
description: This article gives recommendations for writing efficient alert queries.
44
ms.topic: conceptual
5-
ms.date: 2/23/2022
5+
ms.date: 5/30/2023
66
ms.reviewer: yalavi
77
---
88
# Optimize log alert queries

articles/azure-monitor/logs/cross-workspace-query.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article describes how you can query against resources from mul
44
ms.topic: conceptual
55
author: bwren
66
ms.author: bwren
7-
ms.date: 04/01/2023
7+
ms.date: 05/30/2023
88

99
---
1010

@@ -24,7 +24,7 @@ There are two methods to query data that's stored in multiple workspaces and app
2424
2525
## Cross-resource query limits
2626

27-
* The number of Application Insights resources and Log Analytics workspaces that you can include in a single query is limited to 100.
27+
* The number of Application Insights components and Log Analytics workspaces that you can include in a single query is limited to 100.
2828
* Cross-resource queries in log alerts are only supported in the current [scheduledQueryRules API](/rest/api/monitor/scheduledqueryrule-2018-04-16/scheduled-query-rules). If you're using the legacy Log Analytics Alerts API, you'll need to [switch to the current API](../alerts/alerts-log-api-switch.md).
2929
* References to a cross resource, such as another workspace, should be explicit and can't be parameterized. See [Identify workspace resources](#identify-workspace-resources) for examples.
3030

@@ -33,13 +33,13 @@ To reference another workspace in your query, use the [workspace](../logs/worksp
3333

3434
### Identify workspace resources
3535

36-
You can identify a workspace in one of several ways:
36+
You can identify a workspace using one of these IDs:
3737

3838
* **Workspace ID**: A workspace ID is the unique, immutable, identifier assigned to each workspace represented as a globally unique identifier (GUID).
3939

4040
`workspace("00000000-0000-0000-0000-000000000000").Update | count`
4141

42-
* **Azure Resource ID**: This ID is the Azure-defined unique identity of the workspace. You use the Resource ID when the resource name is ambiguous. For workspaces, the format is */subscriptions/subscriptionId/resourcegroups/resourceGroup/providers/microsoft.OperationalInsights/workspaces/workspaceName*.
42+
* **Azure Resource ID**: This ID is the Azure-defined unique identity of the workspace. For workspaces, the format is */subscriptions/subscriptionId/resourcegroups/resourceGroup/providers/microsoft.OperationalInsights/workspaces/workspaceName*.
4343

4444
For example:
4545

@@ -50,13 +50,13 @@ You can identify a workspace in one of several ways:
5050
### Identify an application
5151
The following examples return a summarized count of requests made against an app named *fabrikamapp* in Application Insights.
5252
53-
You can identify an application in Application Insights with the `app(Identifier)` expression. The `Identifier` argument specifies the app by using one of the following IDs:
53+
You can identify an app using one of these IDs:
5454
5555
* **ID**: This ID is the app GUID of the application.
5656
5757
`app("00000000-0000-0000-0000-000000000000").requests | count`
5858
59-
* **Azure Resource ID**: This ID is the Azure-defined unique identity of the app. You use the resource ID when the resource name is ambiguous. The format is */subscriptions/subscriptionId/resourcegroups/resourceGroup/providers/microsoft.OperationalInsights/components/componentName*.
59+
* **Azure Resource ID**: This ID is the Azure-defined unique identity of the app. The format is */subscriptions/subscriptionId/resourcegroups/resourceGroup/providers/microsoft.OperationalInsights/components/componentName*.
6060
6161
For example:
6262
@@ -67,24 +67,25 @@ You can identify an application in Application Insights with the `app(Identifier
6767
### Perform a query across multiple resources
6868
You can query multiple resources from any of your resource instances. These resources can be workspaces and apps combined.
6969
70-
Example for a query across two workspaces:
70+
Example for a query across three workspaces:
7171
7272
```
7373
union
7474
Update,
75-
workspace("00000000-0000-0000-0000-000000000001").Update, workspace("00000000-0000-0000-0000-000000000002").Update
75+
workspace("00000000-0000-0000-0000-000000000001").Update,
76+
workspace("00000000-0000-0000-0000-000000000002").Update
7677
| where TimeGenerated >= ago(1h)
7778
| where UpdateState == "Needed"
7879
| summarize dcount(Computer) by Classification
7980
```
8081
8182
## Use a cross-resource query for multiple resources
82-
When you use cross-resource queries to correlate data from multiple Log Analytics workspaces and Application Insights resources, the query can become complex and difficult to maintain. You should make use of [functions in Azure Monitor log queries](./functions.md) to separate the query logic from the scoping of the query resources. This method simplifies the query structure. The following example demonstrates how you can monitor multiple Application Insights resources and visualize the count of failed requests by application name.
83+
When you use cross-resource queries to correlate data from multiple Log Analytics workspaces and Application Insights components, the query can become complex and difficult to maintain. You should make use of [functions in Azure Monitor log queries](./functions.md) to separate the query logic from the scoping of the query resources. This method simplifies the query structure. The following example demonstrates how you can monitor multiple Application Insights components and visualize the count of failed requests by application name.
8384
84-
Create a query like the following example that references the scope of Application Insights resources. The `withsource= SourceApp` command adds a column that designates the application name that sent the log. [Save the query as a function](./functions.md#create-a-function) with the alias `applicationsScoping`.
85+
Create a query like the following example that references the scope of Application Insights components. The `withsource= SourceApp` command adds a column that designates the application name that sent the log. [Save the query as a function](./functions.md#create-a-function) with the alias `applicationsScoping`.
8586
8687
```Kusto
87-
// crossResource function that scopes my Application Insights resources
88+
// crossResource function that scopes my Application Insights components
8889
union withsource= SourceApp
8990
app('00000000-0000-0000-0000-000000000000').requests,
9091
app('00000000-0000-0000-0000-000000000001').requests,

0 commit comments

Comments
 (0)