Skip to content

Commit 5bce932

Browse files
Merge pull request #97030 from SnehaGunda/monitoring
Monitoring doc formatting updates
2 parents 7357b8e + 1923e42 commit 5bce932

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

articles/cosmos-db/monitor-cosmos-db-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following table lists the properties for Azure Cosmos DB resource logs when
2222
| --- | --- | --- |
2323
| **time** | **TimeGenerated** | The date and time (UTC) when the operation occurred. |
2424
| **resourceId** | **Resource** | The Azure Cosmos DB account for which logs are enabled.|
25-
| **category** | **Category** | For Azure Cosmos DB logs, **DataPlaneRequests** is the only available value. |
25+
| **category** | **Category** | For Azure Cosmos DB logs, **DataPlaneRequests**, **MongoRequests**, **QueryRuntimeStatistics**, **PartitionKeyStatistics**, **PartitionKeyRUConsumption**, **ControlPlaneRequests** are the available log types. |
2626
| **operationName** | **OperationName** | Name of the operation. This value can be any of the following operations: Create, Update, Read, ReadFeed, Delete, Replace, Execute, SqlQuery, Query, JSQuery, Head, HeadFeed, or Upsert. |
2727
| **properties** | n/a | The contents of this field are described in the rows that follow. |
2828
| **activityId** | **activityId_g** | The unique GUID for the logged operation. |

articles/cosmos-db/monitor-cosmos-db.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,51 @@ Data in Azure Monitor Logs is stored in tables which each table having its own s
9595
> [!IMPORTANT]
9696
> When you select **Logs** from the Azure Cosmos DB menu, Log Analytics is opened with the query scope set to the current Azure Cosmos database. This means that log queries will only include data from that resource. If you want to run a query that includes data from other databases or data from other Azure services, select **Logs** from the **Azure Monitor** menu. See [Log query scope and time range in Azure Monitor Log Analytics](../azure-monitor/log-query/scope.md) for details.
9797
98-
### Sample queries
98+
### Azure Cosmos DB Log Analytics queries in Azure Monitor
99+
100+
Here are some queries that you can enter into the **Log search** search bar to help you monitor your Azure Cosmos containers. These queries work with the [new language](../log-analytics/log-analytics-log-search-upgrade.md).
101+
99102
Following are queries that you can use to help you monitor your Azure Cosmos databases.
100103
101104
* To query for all of the diagnostic logs from Azure Cosmos DB for a specified time period:
102105
103106
```Kusto
104-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
107+
AzureDiagnostics
108+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
109+
105110
```
106111
107112
* To query for the 10 most recently logged events:
108113
109114
```Kusto
110-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | take 10
115+
AzureDiagnostics
116+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
117+
| limit 10
111118
```
112119
113120
* To query for all operations, grouped by operation type:
114121
115122
```Kusto
116-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | summarize count() by OperationName
123+
AzureDiagnostics
124+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
125+
| summarize count() by OperationName
117126
```
118127
119-
* To query for all operations, grouped by **Resource**:
128+
* To query for all operations, grouped by resource:
120129
121130
```Kusto
122-
AzureActivity | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | summarize count() by Resource
131+
AzureActivity
132+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
133+
| summarize count() by Resource
134+
123135
```
124136
125137
* To query for all user activity, grouped by resource:
126138
127139
```Kusto
128-
AzureActivity | where Caller == "[email protected]" and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | summarize count() by Resource
140+
AzureActivity
141+
| where Caller == "[email protected]" and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
142+
| summarize count() by Resource
129143
```
130144
* To get all queries greater than 100 RUs joined with data from **DataPlaneRequests** and **QueryRunTimeStatistics**.
131145
@@ -134,9 +148,9 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
134148
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" and todouble(requestCharge_s) > 100.0
135149
| project activityId_g, requestCharge_s
136150
| join kind= inner (
137-
AzureDiagnostics
138-
| where ResourceProvider =="MICROSOFT.DOCUMENTDB" and Category == "QueryRuntimeStatistics"
139-
| project activityId_g, querytext_s
151+
AzureDiagnostics
152+
| where ResourceProvider =="MICROSOFT.DOCUMENTDB" and Category == "QueryRuntimeStatistics"
153+
| project activityId_g, querytext_s
140154
) on $left.activityId_g == $right.activityId_g
141155
| order by requestCharge_s desc
142156
| limit 100
@@ -145,27 +159,35 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
145159
* To query for which operations take longer than 3 milliseconds:
146160
147161
```Kusto
148-
AzureDiagnostics | where toint(duration_s) > 3 and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | summarize count() by clientIpAddress_s, TimeGenerated
162+
AzureDiagnostics
163+
| where toint(duration_s) > 3 and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
164+
| summarize count() by clientIpAddress_s, TimeGenerated
149165
```
150166
151167
* To query for which agent is running the operations:
152168
153169
```Kusto
154-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | summarize count() by OperationName, userAgent_s
170+
AzureDiagnostics
171+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
172+
| summarize count() by OperationName, userAgent_s
155173
```
156174
157175
* To query for when the long running operations were performed:
158176
159177
```Kusto
160-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" | project TimeGenerated , duration_s | render timechart
178+
AzureDiagnostics
179+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
180+
| project TimeGenerated , duration_s
181+
| summarize count() by bin(TimeGenerated, 5s)
182+
| render timechart
161183
```
162184
163185
* To get Partition Key statistics to evaluate skew across top 3 partitions for database account:
164186
165187
```Kusto
166188
AzureDiagnostics
167189
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="PartitionKeyStatistics"
168-
| project SubscriptionId, regionName_s, databaseName_s, collectionname_s, partitionkey_s, sizeKb_s, ResourceId
190+
| project SubscriptionId, regionName_s, databaseName_s, collectionname_s, partitionkey_s, sizeKb_s, ResourceId
169191
```
170192
171193
## Monitor Azure Cosmos DB programmatically

0 commit comments

Comments
 (0)