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
[Monitor][Query] Add resource centric query support (#29365)
This regenerates with autorest and provides an API for
users to query Azure Monitor logs directly from a resource
instead of going through the context of a Log Analytics workspace.
Signed-off-by: Paul Van Eck <[email protected]>
Copy file name to clipboardExpand all lines: sdk/monitor/azure-monitor-query/CHANGELOG.md
+2
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
### Features Added
6
6
7
+
- Add the `query_resource` method to `LogsQueryClient` to allow users to query Azure resources directly without the context of a workspace. ([#29365](https://github.com/Azure/azure-sdk-for-python/pull/29365))
@@ -103,7 +104,7 @@ Each set of metric values is a time series with the following characteristics:
103
104
104
105
### Logs query
105
106
106
-
This example shows getting a logs query. To handle the response and view it in a tabular form, the [pandas](https://pypi.org/project/pandas/) library is used. See the [samples][samples] if you choose not to use pandas.
107
+
This example shows how to query a Log Analytics workspace. To handle the response and view it in a tabular form, the [pandas](https://pypi.org/project/pandas/) library is used. See the [samples][samples] if you choose not to use pandas.
The following example demonstrates how to query logs directly from an Azure resource without the use of a Log Analytics workspace. Here, the `query_resource` method is used instead of `query_workspace`, and instead of a workspace ID, an Azure resource identifier is passed in (e.g. `/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}`).
262
+
263
+
```python
264
+
import os
265
+
import pandas as pd
266
+
from datetime import timedelta
267
+
from azure.monitor.query import LogsQueryClient, LogsQueryStatus
268
+
from azure.core.exceptions import HttpResponseError
0 commit comments