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/cosmos-db/monitor-cosmos-db-reference.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ The following table lists the properties for Azure Cosmos DB resource logs when
22
22
| --- | --- | --- |
23
23
|**time**|**TimeGenerated**| The date and time (UTC) when the operation occurred. |
24
24
|**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. |
26
26
|**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. |
27
27
|**properties**| n/a | The contents of this field are described in the rows that follow. |
28
28
|**activityId**|**activityId_g**| The unique GUID for the logged operation. |
Copy file name to clipboardExpand all lines: articles/cosmos-db/monitor-cosmos-db.md
+36-14Lines changed: 36 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,37 +95,51 @@ Data in Azure Monitor Logs is stored in tables which each table having its own s
95
95
> [!IMPORTANT]
96
96
> 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.
97
97
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
+
99
102
Following are queries that you can use to help you monitor your Azure Cosmos databases.
100
103
101
104
* To query for all of the diagnostic logs from Azure Cosmos DB for a specified time period:
102
105
103
106
```Kusto
104
-
AzureDiagnostics | where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
107
+
AzureDiagnostics
108
+
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
109
+
105
110
```
106
111
107
112
* To query for the 10 most recently logged events:
108
113
109
114
```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
111
118
```
112
119
113
120
* To query for all operations, grouped by operation type:
114
121
115
122
```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
117
126
```
118
127
119
-
* To query for all operations, grouped by **Resource**:
128
+
* To query for all operations, grouped by resource:
120
129
121
130
```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
+
123
135
```
124
136
125
137
* To query for all user activity, grouped by resource:
126
138
127
139
```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
129
143
```
130
144
* To get all queries greater than 100 RUs joined with data from **DataPlaneRequests** and **QueryRunTimeStatistics**.
131
145
@@ -134,9 +148,9 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
134
148
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" and todouble(requestCharge_s) > 100.0
135
149
| project activityId_g, requestCharge_s
136
150
| 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
140
154
) on $left.activityId_g == $right.activityId_g
141
155
| order by requestCharge_s desc
142
156
| limit 100
@@ -145,27 +159,35 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
145
159
* To query for which operations take longer than 3 milliseconds:
146
160
147
161
```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
149
165
```
150
166
151
167
* To query for which agent is running the operations:
152
168
153
169
```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
155
173
```
156
174
157
175
* To query for when the long running operations were performed:
158
176
159
177
```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
161
183
```
162
184
163
185
* To get Partition Key statistics to evaluate skew across top 3 partitions for database account:
164
186
165
187
```Kusto
166
188
AzureDiagnostics
167
189
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="PartitionKeyStatistics"
0 commit comments