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/log-analytics/log-analytics-cross-workspace-search.md
+7-10Lines changed: 7 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,21 +100,21 @@ union Update, workspace("contosoretail-it").Update, workspace("b459b4u5-912x-46d
100
100
## Using cross-resource query for multiple resources
101
101
When using cross-resource queries to correlate data from multiple Log Analytics and Application Insights resources, the query can become complex and difficult to maintain. You should leverage [functions in Log Analytics](query-language/functions.md) to separate the query logic from the scoping of the query resources, which 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.
102
102
103
-
Create a query like the following that references the scope of Application Insights resources. The `withsource= SourceApp` command adds a column that designates the application name that sent the log.
103
+
Create a query like the following 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 function](query-language/functions.md#create-a-function) with the alias _applicationsScoping_.
104
104
105
105
```Kusto
106
106
// crossResource function that scopes my Application Insights resources
107
107
union withsource= SourceApp
108
108
app('Contoso-app1').requests,
109
-
app(''Contoso-app2').requests,
110
-
app(''Contoso-app3').requests,
111
-
app(''Contoso-app4').requests,
112
-
app(''Contoso-app5').requests
109
+
app('Contoso-app2').requests,
110
+
app('Contoso-app3').requests,
111
+
app('Contoso-app4').requests,
112
+
app('Contoso-app5').requests
113
113
```
114
114
115
-
[Save the query as function](query-language/functions.md#create-a-function) with the alias _applicationsScoping_.
116
115
117
-
You can now [use this function](query-language/functions.md#use-a-function) in a cross-resource query like the following. The Function alias _applicationsScoping_ returns the union of requests table from all the defined applications. The query then filters for failed requests and visualizes the trends by application
116
+
117
+
You can now [use this function](query-language/functions.md#use-a-function) in a cross-resource query like the following. The function alias _applicationsScoping_ returns the union of the requests table from all the defined applications. The query then filters for failed requests and visualizes the trends by application. The _parse_ operator is optional in this example. It extracts the application name from _SourceApp_ property.
118
118
119
119
```Kusto
120
120
applicationsScoping
@@ -126,9 +126,6 @@ applicationsScoping
126
126
| render timechart
127
127
```
128
128
129
-
The _parse_ operator is optional in this example. It extracts the application name from _SourceApp_ property.
Copy file name to clipboardExpand all lines: articles/log-analytics/query-language/functions.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Create a function in the Azure portal by clicking **Save** and then providing th
51
51
Use a function by including its alias in another query. It can be used like any other table.
52
52
53
53
## Example
54
-
The following sample query returns all missing security updates reported in the last day:
54
+
The following sample query returns all missing security updates reported in the last day. Save this query as a function with the alias _security_updates_last_day_.
55
55
56
56
```Kusto
57
57
Update
@@ -60,9 +60,7 @@ Update
60
60
| where UpdateState == "Needed"
61
61
```
62
62
63
-
Save this query as a function with the alias _security_updates_last_day_.
64
-
65
-
Create another to search for SQL-related needed security updates:
63
+
Create another to search for SQL-related needed security updates.
66
64
67
65
```Kusto
68
66
security_updates_last_day | where Title contains "SQL"
0 commit comments