Skip to content

Commit 2b0525e

Browse files
Merge pull request #231106 from seesharprun/cosmos-monitor-queries
Cosmos DB | Update monitor logs query titles and copy edit
2 parents d931c4e + d598e18 commit 2b0525e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

articles/cosmos-db/monitor-logs-basic-queries.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
22
title: Troubleshoot issues with diagnostics queries
33
titleSuffix: Azure Cosmos DB
4-
description: Learn how to query diagnostics logs for troubleshooting data stored in Azure Cosmos DB
4+
description: Query diagnostics logs using the Kusto query language (KQL) to troubleshoot queries and operations in Azure Cosmos DB.
55
author: StefArroyo
66
services: cosmos-db
77
ms.service: cosmos-db
88
ms.custom: ignite-2022
9-
ms.topic: how-to
10-
ms.date: 05/12/2021
9+
ms.topic: reference
10+
ms.date: 03/16/2023
1111
ms.author: esarroyo
1212
---
1313

1414
# Troubleshoot issues with diagnostics queries
15+
1516
[!INCLUDE[NoSQL, MongoDB, Cassandra, Gremlin, Table](includes/appliesto-nosql-mongodb-cassandra-gremlin-table.md)]
1617

17-
In this article, we'll cover how to write simple queries to help troubleshoot issues with your Azure Cosmos DB account using diagnostics logs sent to **AzureDiagnostics (legacy)** and **Resource-specific (preview)** tables.
18+
In this article, we cover how to write simple queries to help troubleshoot issues with your Azure Cosmos DB account using diagnostics logs sent to **AzureDiagnostics (legacy)** and **Resource-specific (preview)** tables.
1819

19-
For Azure Diagnostics tables, all data is written into one single table and users will need to specify which category they'd like to query.
20+
For Azure Diagnostics tables, all data is written into one single table and users need to specify which category they'd like to query.
2021

2122
For resource-specific tables, data is written into individual tables for each category of the resource (not available for table API). We recommend this mode since it makes it much easier to work with the data, provides better discoverability of the schemas, and improves performance across both ingestion latency and query times.
2223

23-
## <a id="azure-diagnostics-queries"></a> AzureDiagnostics Queries
24+
## Azure diagnostics queries
2425

2526
- How to query for the operations that are taking longer than 3 milliseconds to run:
2627

@@ -47,8 +48,8 @@ For resource-specific tables, data is written into individual tables for each ca
4748
| summarize count() by bin(TimeGenerated, 5s)
4849
| render timechart
4950
```
50-
51-
- How to get partition key statistics to evaluate skew across top 3 partitions for a database account:
51+
52+
- How to get partition key statistics to evaluate skew across top three partitions for a database account:
5253

5354
```Kusto
5455
AzureDiagnostics
@@ -119,7 +120,7 @@ For resource-specific tables, data is written into individual tables for each ca
119120
```
120121

121122
- What is the maximum throughput that a partition has consumed?
122-
123+
123124
```kusto
124125
AzureDiagnostics
125126
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
@@ -162,27 +163,26 @@ For resource-specific tables, data is written into individual tables for each ca
162163
| where todouble(sizeKb_d) > 800000
163164
```
164165

165-
- How to get P99 or P50 replication latencies for operations, request charge or the length of the response?
166+
- How to get P99 or P50 latencies for operations, request charge or the length of the response?
166167

167168
```kusto
168169
AzureDiagnostics
169170
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
170171
| where TimeGenerated >= ago(2d)
171172
| summarize percentile(todouble(responseLength_s), 50), percentile(todouble(responseLength_s), 99), max(responseLength_s), percentile(todouble(requestCharge_s), 50), percentile(todouble(requestCharge_s), 99), max(requestCharge_s), percentile(todouble(duration_s), 50), percentile(todouble(duration_s), 99), max(duration_s), count() by OperationName, requestResourceType_s, userAgent_s, collectionRid_s, bin(TimeGenerated, 1h)
172173
```
173-
174+
174175
- How to get ControlPlane logs?
175-
176+
176177
Remember to switch on the flag as described in the [Disable key-based metadata write access](audit-control-plane-logs.md#disable-key-based-metadata-write-access) article, and execute the operations by using Azure PowerShell, the Azure CLI, or Azure Resource Manager.
177-
178+
178179
```kusto
179180
AzureDiagnostics
180181
| where Category =="ControlPlaneRequests"
181182
| summarize by OperationName
182183
```
183184

184-
185-
## <a id="resource-specific-queries"></a> Resource-specific Queries
185+
## Resource-specific queries
186186

187187
- How to query for the operations that are taking longer than 3 milliseconds to run:
188188

@@ -207,8 +207,8 @@ For resource-specific tables, data is written into individual tables for each ca
207207
| summarize count() by bin(TimeGenerated, 5s)
208208
| render timechart
209209
```
210-
211-
- How to get partition key statistics to evaluate skew across top 3 partitions for a database account:
210+
211+
- How to get partition key statistics to evaluate skew across top three partitions for a database account:
212212

213213
```kusto
214214
CDBPartitionKeyStatistics
@@ -292,7 +292,7 @@ For resource-specific tables, data is written into individual tables for each ca
292292
| where parse_json(PartitionKey)[0] == "2"
293293
```
294294

295-
- How to get the top partition keys with most RU/s consumed in a specific period?
295+
- How to get the top partition keys with most RU/s consumed in a specific period?
296296

297297
```kusto
298298
CDBPartitionKeyRUConsumption
@@ -306,26 +306,26 @@ For resource-specific tables, data is written into individual tables for each ca
306306
```kusto
307307
CDBPartitionKeyStatistics
308308
| where todouble(SizeKb) > 800000
309-
```
309+
```
310310

311-
- How to get P99 or P50 replication latencies for operations, request charge or the length of the response?
311+
- How to get P99 or P50 latencies for operations, request charge or the length of the response?
312312

313313
```kusto
314314
CDBDataPlaneRequests
315315
| where TimeGenerated >= ago(2d)
316316
| summarize percentile(todouble(ResponseLength), 50), percentile(todouble(ResponseLength), 99), max(ResponseLength), percentile(todouble(RequestCharge), 50), percentile(todouble(RequestCharge), 99), max(RequestCharge), percentile(todouble(DurationMs), 50), percentile(todouble(DurationMs), 99), max(DurationMs),count() by OperationName, RequestResourceType, UserAgent, CollectionName, bin(TimeGenerated, 1h)
317317
```
318-
318+
319319
- How to get ControlPlane logs?
320-
320+
321321
Remember to switch on the flag as described in the [Disable key-based metadata write access](audit-control-plane-logs.md#disable-key-based-metadata-write-access) article, and execute the operations by using Azure PowerShell, the Azure CLI, or Azure Resource Manager.
322-
322+
323323
```kusto
324324
CDBControlPlaneRequests
325325
| summarize by OperationName
326326
```
327327

328-
## Next steps
329-
* For more information on how to create diagnostic settings for Azure Cosmos DB see [Creating Diagnostics settings](monitor-resource-logs.md) article.
328+
## Next steps
330329

331-
* For detailed information about how to create a diagnostic setting by using the Azure portal, CLI, or PowerShell, see [create diagnostic setting to collect platform logs and metrics in Azure](../azure-monitor/essentials/diagnostic-settings.md) article.
330+
- For more information on how to create diagnostic settings for Azure Cosmos DB, see [Creating Diagnostics settings](monitor-resource-logs.md).
331+
- For detailed information about how to create a diagnostic setting by using the Azure portal, CLI, or PowerShell, see [create diagnostic setting to collect platform logs and metrics in Azure](../azure-monitor/essentials/diagnostic-settings.md).

0 commit comments

Comments
 (0)