Skip to content

Commit 37bcb48

Browse files
authored
Merge pull request #2569 from HeidiSteen/heidist-monitor2
[azure search] Add enable logging doc
2 parents af56131 + 64e2f01 commit 37bcb48

File tree

7 files changed

+114
-3
lines changed

7 files changed

+114
-3
lines changed
54.9 KB
Loading
62.7 KB
Loading

articles/search/search-manage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Some features add to the cost of running the service:
9898

9999
### Enable diagnostic logging
100100

101-
[Enable diagnostic logging](monitor-azure-cognitive-search.md#enable-diagnostic-logging) to track user activity. If you skip this step, you still get [activity logs](/azure/azure-monitor/essentials/activity-log) and [platform metrics](/azure/azure-monitor/essentials/data-platform-metrics#types-of-metrics) automatically, but if you want index and query usage information, you should enable diagnostic logging and choose a destination for logged operations.
101+
[Enable diagnostic logging](search-monitor-enable-logging.md) to track user activity. If you skip this step, you still get [activity logs](/azure/azure-monitor/essentials/activity-log) and [platform metrics](/azure/azure-monitor/essentials/data-platform-metrics#types-of-metrics) automatically, but if you want index and query usage information, you should enable diagnostic logging and choose a destination for logged operations.
102102

103103
We recommend Log Analytics Workspace for durable storage so that you can run system queries in the Azure portal.
104104

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: Configure logging
3+
titleSuffix: Azure AI Search
4+
description: Set up diagnostic logging to collect information about indexing and query processing in Azure AI Search resource logs.
5+
6+
manager: nitinme
7+
author: HeidiSteen
8+
ms.author: heidist
9+
ms.service: azure-ai-search
10+
ms.topic: how-to
11+
ms.date: 01/28/2025
12+
---
13+
14+
# Configure diagnostic logging for Azure AI Search
15+
16+
Resource-level diagnostic logs provide insight into operations that occur in your Azure AI Search resource. In contrast, activity logs provide an insight into the operations performed on each Azure resource in the subscription from the outside, known as the control plane or management plane. Activity logging is enabled automatically, and often
17+
18+
This article explains how to enable resource-level diagnostic logging and how to find information about system and user operations on an Azure AI Search resource.
19+
20+
## Prerequisites
21+
22+
- An [Azure Log Analytics workspace](/azure/azure-monitor/logs/quick-create-workspace) in the same subscription.
23+
24+
## Enable diagnostic logging
25+
26+
Diagnostic logging is available through Azure Monitor. Although some logging, like Activity Logs and built-in metrics, is reported automatically with no upfront configuration, resource-level logs about in-service operations and data access require that you create a diagnostic setting and specify a storage option.
27+
28+
1. Sign in to the [Azure portal](https://portal.azure.com) and navigate to your search service.
29+
30+
1. Under **Monitoring** > **Diagnostic settings**, select **Add diagnostic setting**.
31+
32+
1. Provide a name that identifies the service and level of logging, such as "my-search-service-all-logs" or "my-search-service-audit-logs".
33+
34+
1. Under **Logs**, choose a category:
35+
36+
- **Audit logs** capture user or app interactions with data or the settings of the service, but don't include user or groups identities.
37+
- **Operation logs** capture information about operations on a search service.
38+
- **allLogs** collect everything.
39+
40+
Verbose logging can be expensive to store and complex to manage and store. You might want to start with **allLogs** and then switch to more scoped logging if it meets your information requirements. For more information about these categories, see [Diagnostic settings in Azure Monitor](/azure/azure-monitor/essentials/diagnostic-settings).
41+
42+
1. For a destination, we recommend **Send to Log Analytics workspace** so that you can run Kusto queries against the data. There should be a workspace available
43+
44+
1. Save the settings.
45+
46+
Repeat these steps if you require a more [comprehensive data collection strategy](/azure/azure-monitor/logs/workspace-design).
47+
48+
Each diagnostic setting you create requires its own data sink. If you use the Azure portal to review logs, the first diagnostic setting is used by default. You can navigate to specific workspaces for visualization support.
49+
50+
> [!NOTE]
51+
> If you're using [key-based authentication](search-security-api-keys.md), Azure AI Search can't monitor individual user access to content on the search service. If you require this level of monitoring, you need to implement it in your client application.
52+
53+
## View logs in Log Analytics
54+
55+
Follow these instructions to explore log analytics data for your resource.
56+
57+
1. Under **Monitoring**, select **Logs**. Query hub opens by default. You can try the available queries, or close the hub and open a query window in KQL mode to run queries written in the [Kusto Query Language (KQL)](/kusto/query).
58+
59+
:::image type="content" source="media/search-monitor-enable-logging/enable-kql-mode.png" alt-text="Screenshot of the KQL mode option in the Azure portal query explorer.":::
60+
61+
1. In a query window, you can run Kusto queries against your logs.
62+
63+
:::image type="content" source="media/search-monitor-enable-logging/query-example.png" alt-text="Screenshot of a query and results in the Azure portal.":::
64+
65+
### Sample queries
66+
67+
Here are a few basic Kusto queries you can use to explore your log data.
68+
69+
Run this query for all diagnostic logs from Azure AI Search services over the specified time period:
70+
71+
```kusto
72+
AzureDiagnostics
73+
| where ResourceProvider == "MICROSOFT.SEARCH"
74+
```
75+
76+
Run this query to see the 10 most recent logs:
77+
78+
```kusto
79+
AzureDiagnostics
80+
| where ResourceProvider == "MICROSOFT.SEARCH"
81+
| take 10
82+
```
83+
84+
Run this query to group operations by **Resource**:
85+
86+
```kusto
87+
AzureDiagnostics
88+
| where ResourceProvider == "MICROSOFT.SEARCH" |
89+
summarize count() by Resource
90+
```
91+
92+
Run this query to find the average time it takes to perform an operation:
93+
94+
```kusto
95+
AzureDiagnostics
96+
| where ResourceProvider == "MICROSOFT.SEARCH"
97+
| summarize avg(DurationMs)
98+
by OperationName
99+
```
100+
101+
Run this query to view the volume of operations over time split by OperationName with counts binned for every 10 seconds.
102+
103+
```kusto
104+
AzureDiagnostics
105+
| where ResourceProvider == "MICROSOFT.SEARCH"
106+
| summarize count()
107+
by bin(TimeGenerated, 10s), OperationName
108+
| render areachart kind=unstacked
109+
```

articles/search/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ items:
516516
items:
517517
- name: Monitor
518518
href: monitor-azure-cognitive-search.md
519+
- name: Enable diagnostic logging
520+
href: search-monitor-enable-logging.md
519521
- name: Monitor queries
520522
href: search-monitor-queries.md
521523
- name: Monitor indexer-based indexing

articles/search/vector-search-how-to-configure-vectorizer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Vectorizers are now generally available as long as you use a generally available
3434

3535
+ [Visual Studio Code](https://code.visualstudio.com/download) with a [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) to send the query and accept a response.
3636

37-
We recommend that you [enable diagnostic logging](monitor-azure-cognitive-search.md#enable-diagnostic-logging) on your search service to confirm vector query execution.
37+
We recommend that you [enable diagnostic logging](search-monitor-enable-logging.md) on your search service to confirm vector query execution.
3838

3939
## Supported embedding models
4040

articles/search/vector-store.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Azure AI Search implements data encryption, private connections for no-internet
211211

212212
Azure provides a [monitoring platform](monitor-azure-cognitive-search.md) that includes diagnostic logging and alerting. We recommend the following best practices:
213213

214-
+ [Enable diagnostic logging](monitor-azure-cognitive-search.md#enable-diagnostic-logging)
214+
+ [Enable diagnostic logging](search-monitor-enable-logging.md)
215215
+ [Set up alerts](/azure/azure-monitor/alerts/tutorial-metric-alert)
216216
+ [Analyze query and index performance](search-performance-analysis.md)
217217

0 commit comments

Comments
 (0)