Skip to content

Commit 46a0b7e

Browse files
committed
separated activity log to new article. added content about wmpty results and wild card
1 parent d4b2fd6 commit 46a0b7e

File tree

4 files changed

+102
-73
lines changed

4 files changed

+102
-73
lines changed

articles/azure-monitor/essentials/data-platform-metrics.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ The differences between each of the metrics are summarized in the following tabl
4646

4747
Azure Monitor collects metrics from the following sources. After these metrics are collected in the Azure Monitor metric database, they can be evaluated together regardless of their source:
4848

49-
- **Azure resources**: Platform metrics are created by Azure resources and give you visibility into their health and performance. Each type of resource creates a [distinct set of metrics](./metrics-supported.md) without any configuration required. Platform metrics are collected from Azure resources at one-minute frequency unless specified otherwise in the metric's definition.
49+
- **Azure resources**: Platform metrics are created by Azure resources and give you visibility into their health and performance. Each type of resource creates a [distinct set of metrics](./metrics-supported.md) without any configuration required. Platform metrics are collected from Azure resources at one-minute frequency unless specified otherwise in the metric's definition.
5050
- **Applications**: Application Insights creates metrics for your monitored applications to help you detect performance issues and track trends in how your application is being used. Values include _Server response time_ and _Browser exceptions_.
5151
- **Virtual machine agents**: Metrics are collected from the guest operating system of a virtual machine. You can enable guest OS metrics for Windows virtual machines by using the [Azure Monitor Agent](/azure/azure-monitor/agents/agents-overview). Azure Monitor Agent replaces the legacy agents - [Windows diagnostic extension](../agents/diagnostics-extension-overview.md) and the [InfluxData Telegraf agent](https://www.influxdata.com/time-series-platform/telegraf/) for Linux virtual machines.
5252
- **Custom metrics**: You can define metrics in addition to the standard metrics that are automatically available. You can [define custom metrics in your application](../app/api-custom-events-metrics.md) that's monitored by Application Insights. You can also create custom metrics for an Azure service by using the [custom metrics API](./metrics-store-custom-rest-api.md).
5353
- **Kubernetes clusters**: Kubernetes clusters typically send metric data to a local Prometheus server that you must maintain. [Azure Monitor managed service for Prometheus ](prometheus-metrics-overview.md) provides a managed service that collects metrics from Kubernetes clusters and store them in Azure Monitor Metrics.
5454

55+
> [!NOTE]
56+
> Metrics collected from different sources and by different methods may be aggregated differently. For example, platform metrics are pre-aggregated and stored in a time-series database, while Prometheus metrics are stored as raw data.Resource metrics may also have a different latency than other metrics. This can lead to differences in metric values for a specific sample time. Over time the, and when analyzing the metrics at the same time granularity, these differences disappear.
57+
5558
## REST API
5659

5760
Azure Monitor provides REST APIs that allow you to get data in and out of Azure Monitor Metrics.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Retrieve activity log data using Azure monitor REST API
3+
description: How to retrieve activity log data using Azure monitor REST API.
4+
author: EdB-MSFT
5+
ms.topic: conceptual
6+
ms.date: 03/10/2024
7+
ms.reviewer: priyamishra
8+
9+
# customer intent: As a developer, I want to learn how to retrieve activity log data using Azure monitor REST API.
10+
---
11+
12+
# Retrieve activity log data using Azure monitor REST API
13+
14+
The Azure Activity Log is a log that provides insight into operations performed on resources in your subscription. Operations include create, update, delete, and other actions taken on resources. The Activity Log is a platform-wide log and isn't limited to a particular service. This article explains how to retrieve activity log data using the Azure Monitor REST API. For more information about the activity log, see [Azure Activity Log event schema](/azure/azure-monitor/essentials/activity-log-schema).
15+
16+
17+
## Authentication
18+
19+
To retrieve resource logs, you must authenticate with Microsoft Entra. For more information, see [Azure monitoring REST API walkthrough](/azure/azure-monitor/essentials/rest-api-walkthrough?tabs=powershell#authenticate-azure-monitor-requests).
20+
21+
## Retrieve activity log data
22+
23+
Use the Azure Monitor REST API to query [activity log](/rest/api/monitor/activitylogs) data.
24+
25+
The following request format is used to request activity log data.
26+
27+
```curl
28+
GET /subscriptions/<subscriptionId>/providers/Microsoft.Insights/eventtypes/management/values \
29+
?api-version=2015-04-01 \
30+
&$filter=<filter> \
31+
&$select=<select>
32+
host: management.azure.com
33+
authorization: Bearer <token>
34+
```
35+
36+
### $filter
37+
`$filter` reduces the set of data collected. This argument is required and it also requires at least the start date/time.
38+
The `$filter` argument accepts the following patterns:
39+
- List events for a resource group: `$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq <resourceGroupName>`.
40+
- List events for a specific resource: `$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq <resourceURI>`.
41+
- List events for a subscription in a time range: `$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'`.
42+
- List events for a resource provider: `$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq <resourceProviderName>`.
43+
- List events for a correlation ID:` $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq '<correlationID>`.
44+
45+
46+
### $select
47+
`$select` fetches a specified list of properties for the returned events.
48+
The `$select` argument is a comma separated list of property names to be returned.
49+
Valid values are:
50+
`authorization`, `claims`, `correlationId`, `description`, `eventDataId`, `eventName`, `eventTimestamp`, `httpRequest`, `level`, `operationId`, `operationName`, `properties`, `resourceGroupName`, `resourceProviderName`, `resourceId`, `status`, `submissionTimestamp`, `subStatus`, and `subscriptionId`.
51+
52+
The following sample requests use the Azure Monitor REST API to query an activity log.
53+
### Get activity logs with filter:
54+
55+
The following example gets the activity logs for resource group `MSSupportGroup` between the dates `2023-03-21T20:00:00Z` and `2023-03-24T20:00:00Z`
56+
57+
``` HTTP
58+
GET https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2023-03-21T20:00:00Z' and eventTimestamp le '2023-03-24T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'
59+
```
60+
### Get activity logs with filter and select:
61+
62+
The following example gets the activity logs for resource group `MSSupportGroup`, between the dates `2023-03-21T20:00:00Z` and `2023-03-24T20:00:00Z`, returning the elements eventName, operationName, status, eventTimestamp, correlationId, submissionTimestamp, and level.
63+
64+
```HTTP
65+
GET https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2023-03-21T20:00:00Z' and eventTimestamp le '2023-03-24T20:00:00Z'and resourceGroupName eq 'MSSupportGroup'&$select=eventName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level
66+
```
67+
68+
## Next steps
69+
[Stream Azure Monitor activity log data](azure/azure-monitor/essentials/activity-log).
70+
[Azure Activity Log event schema](/azure/azure-monitor/essentials/activity-log-schema).
71+

0 commit comments

Comments
 (0)