Skip to content

Commit 5b6c1fa

Browse files
committed
Rough draft of diagnostic logging document.
1 parent fd8dd2a commit 5b6c1fa

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Diagnostic Logging
3+
titleSuffix: Cognitive Services - Azure
4+
description: This guide provides step-by-step instructions to enable diagnostic logging for an Azure Cognitive Service. These logs provide rich, frequent data about the operation of a resource that are used for issue identification and debugging.
5+
services: cognitive-services
6+
author: erhopf
7+
manager: cgronlun
8+
ms.service: cognitive-services
9+
ms.topic: article
10+
ms.date: 10/10/2018
11+
ms.author: erhopf
12+
---
13+
14+
# Enable diagnostic Logging for Azure Cognitive Services
15+
16+
This guide provides step-by-step instructions to enable diagnostic logging for an Azure Cognitive Service. These logs provide rich, frequent data about the operation of a resource that are used for issue identification and debugging. Before you continue, you must have an Azure account with a subscription to at least one Cognitive Service, such as [Bing Web Search](), [Computer Vision](), or [LUIS]().
17+
18+
## Prerequisites
19+
20+
To enable diagnostic logging, you'll need somewhere to store your log data. This tutorial uses Azure Storage and Log Analytics.
21+
22+
* [Azure storage](https://docs.microsoft.com/azure/monitoring-and-diagnostics/monitoring-archive-diagnostic-logs) - Retains diagnostic logs for policy audit, static analysis, or backup. The storage account does not have to be in the same subscription as the resource emitting logs as long as the user who configures the setting has appropriate RBAC access to both subscriptions.
23+
* [Log Analytics](https://docs.microsoft.com/azure/monitoring-and-diagnostics/monitor-stream-diagnostic-logs-log-analytics) - A flexible log search and analytics tool that allows for analysis of raw logs generated by an Azure resource.
24+
25+
> [!NOTE]
26+
> Additional configuration options are available. To learn more, see [Collect and consume log data from your Azure resources](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-overview-of-diagnostic-logs).
27+
28+
## Enable diagnostic log collection
29+
30+
Let's start by enabling diagnostic logging using the Azure portal.
31+
32+
> [!NOTE]
33+
> To enable this feature using PowerShell or the Azure CLI, use the instructions provided in [Collect and consume log data from your Azure resources](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-overview-of-diagnostic-logs#how-to-enable-collection-of-diagnostic-logs).
34+
35+
1. Navigate to the Azure portal. Then locate and select a Cognitive Services resource. For example, your subscription to Bing Web Search.
36+
2. Next, from the left-hand navigation menu, locate **Monitoring** and select **Diagnostic settings**. This screen contains all previously created diagnostic settings for this resource.
37+
3. If there is a previously created resource that you'd like to use, you can select it now. Otherwise, select **+ Add diagnostic setting**.
38+
4. Enter a name for the setting. Then select **Archive to a storage account** and **Send to log Analytics**.
39+
5. When prompted to configure, select the storage account and OMS workspace that you'd like to use to store you diagnostic logs. **Note**: If you don't have a storage account or OMS workspace, follow the prompts to create one.
40+
6. Select **Audit**, **RequestResponse**, and **AllMetrics**. Then set the desired retention period for your diagnostic log data. If a retention policy is set to zero, events for that log category are stored indefinitely.
41+
7. Click **Save**.
42+
43+
It can take up to two hours before logging data is available to query and analyze. So don't worry if you don't see anything right away.
44+
45+
## View and export diagnostic data from Azure Storage
46+
47+
Azure Storage is a robust object storage solution that is optimized for storing large amounts of unstructured data. In this section, you'll learn to query your storage account for total transactions over a 30 day timeframe and export the data to excel.
48+
49+
1. From the Azure portal, locate the Azure Storage resource that you created in the last section.
50+
2. From the left-hand navigation menu, locate **Monitoring** and select **Metrics**.
51+
3. Use the available drop-downs to configure your query. For this example, let's set the time range to **Last 30 days** and the metric to **Transaction**.
52+
4. When the query is complete, you'll see a visualization of transaction over the last 30 days. To export this data, use the **Export to Excel** button located at the top of the page.
53+
54+
Learn more about what you can do with diagnostic data in [Azure Storage](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction).
55+
56+
## View logs in Log Analytics
57+
58+
<Some intro>
59+
60+
1. From the Azure Portal, locate and select **Log Analytics** from the left-hand navigation menu.
61+
2. Locate and select the resource you created when enabling diagnostics.
62+
3. Under **General**, locate and select **Logs**. From this page, you can run queries against your logs.
63+
64+
### Sample queries
65+
66+
Now that you've enabled data collection, run this query to see the 10 most recent logs:
67+
68+
```
69+
AzureDiagnostics | take 10
70+
```
71+
72+
<-! Work with Greg to add additional queries ->
73+
74+
## Set an alert
75+
76+
<-! Work with Greg to provide context for alerts. ->
77+
78+
## Schema
79+
80+
<-! Work with Greg to complete the JSON schema. ->

0 commit comments

Comments
 (0)