Skip to content

Commit becb48c

Browse files
authored
Merge pull request #275093 from dlepow/dpaudit
[APIM] Developer portal audit logs
2 parents 1e05e1d + 07df85e commit becb48c

File tree

6 files changed

+133
-6
lines changed

6 files changed

+133
-6
lines changed

articles/api-management/TOC.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@
393393
href: api-management-howto-oauth2.md
394394
- name: Integrate Application Insights
395395
href: developer-portal-integrate-application-insights.md
396+
- name: Log developer portal usage
397+
href: developer-portal-enable-usage-logs.md
396398
- name: Integrate Google Tag Manager
397399
href: developer-portal-integrate-google-tag-manager.md
398400
- name: Self-host the developer portal
@@ -615,8 +617,10 @@
615617
- name: Azure Policy built-ins
616618
displayName: samples, policies, definitions
617619
href: ./policy-reference.md
618-
- name: Resource log schema
620+
- name: Gateway log schema
619621
href: gateway-log-schema-reference.md
622+
- name: Developer portal audit log schema
623+
href: developer-portal-audit-log-schema-reference.md
620624
- name: Event Grid events schema
621625
href: ../event-grid/event-schema-api-management.md?toc=/azure/api-management/toc.json&bc=/azure/api-management/breadcrumb/toc.json
622626
- name: Virtual network configuration
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: Reference - Azure API Management developer portal audit log
3+
description: Schema reference for the Azure API Management DeveloperPortalAuditLogs log. Entries include properties that are logged for requests to the developer portal.
4+
services: api-management
5+
author: dlepow
6+
7+
ms.service: api-management
8+
ms.custom: mvc
9+
ms.topic: reference
10+
ms.date: 05/14/2024
11+
ms.author: danlep
12+
---
13+
# Reference: Developer portal audit log schema
14+
15+
[!INCLUDE [api-management-availability-premium-dev-standard-basic](../../includes/api-management-availability-premium-dev-standard-basic.md)]
16+
17+
This article provides a schema reference for the Azure API Management DeveloperPortalAuditLogs resource log.
18+
19+
To enable collection of the resource log in API Management, see [Enable logging of developer portal usage](developer-portal-enable-usage-logs.md).
20+
21+
## DeveloperPortalAuditLogs schema
22+
23+
The following fields are logged for each request to the developer portal.
24+
25+
| Field | Type | Description |
26+
| ------------- | ------------- | ------------- |
27+
| Sku | string | Pricing tier |
28+
| DeploymentVersion | string | API Management code base version |
29+
| Level | int | Log level as number from 1 - 5.<br/><br/> `1 - 2`: errors<br/> `3`: warnings<br/> `4 - 5`: tracing logs|
30+
| resourceId | string | Azure Resource Manager resource identifier<br/><br/>Example: `/SUBSCRIPTIONS/MYSUBSCRIPTION/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/MYAPIMSERVICE`|
31+
| category | string | `DeveloperPortalAuditLogs`|
32+
| resultType | string | Result type, either `Succeeded` or `Failed`|
33+
| operationName | string | `Microsoft.ApiManagement/CustomerDevPortalAuditDiagnosticLogs` |
34+
| eventTime | string | Date and time in UTC of an event<br/><br/> Example: `2024-05-13T09:15:26.012166Z`|
35+
| apimClient | string | Value taken from `X-Ms-Apim-Client` HTTP header sent on each request by developer portal webpage. Each part is separated by `|` character. Contains information about service type, domain name, API used, and user authorization status<br/><br/>Example: `dev-portal|myapimservice123.developer.azure-api.net|getApis-unauthorized`|
36+
| activityId | string | Unique log GUID|
37+
| properties | dynamic \| object | Object representing additional log information|
38+
39+
### Properties
40+
41+
| Field name | Type | Description |
42+
| ------------- | ------------- | ------------- |
43+
| hashedUserId | string \| null | Hashed user ID or `null` if the request is anonymous |
44+
| timestamp | string | Date and time in UTC when the request was made<br/><br/> Example: `2024-05-13T09:15:26.4496706Z` |
45+
| requestPath | string | HTTP request URL path<br/><br/>Example: `/apis` or `/tags` |
46+
| requestMethod | string | HTTP request method |
47+
| userAgent | string | Browser's user agent string taken from HTTP request header. Identifies browser, browser version, and operating system.<br/><br/>Example: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36` |
48+
| responseCode | int | HTTP response code |
49+
| region | string | Azure region name<br/><br/>Example: `Brazil South` |
50+
| serviceName | string | Name of the API Management service |
51+
52+
53+
## Related content
54+
55+
* [ApiManagementGatewayLogs schema reference](gateway-log-schema-reference.md)
56+
* Learn more about [Common and service-specific schema for Azure Resource Logs](../azure-monitor/essentials/resource-logs-schema.md)
57+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Enable usage logs - Developer portal - Azure API Management
3+
description: Enable logs to monitor usage of the developer portal in Azure API Management. Usage data includes views of API and product details.
4+
services: api-management
5+
author: dlepow
6+
7+
ms.service: api-management
8+
ms.custom:
9+
ms.topic: how-to
10+
ms.date: 05/23/2024
11+
ms.author: danlep
12+
---
13+
14+
# Enable logging of developer portal usage in Azure API Management
15+
16+
[!INCLUDE [api-management-availability-premium-dev-standard-basic](../../includes/api-management-availability-premium-dev-standard-basic.md)]
17+
18+
This article shows you how to enable Azure Monitor logs for auditing and troubleshooting usage of the API Management [developer portal](developer-portal-overview.md). When enabled through a diagnostic setting, the logs collect information about the requests that are received and processed by the developer portal.
19+
20+
Developer portal usage logs include data about activity in the developer portal, including:
21+
22+
* User authentication actions, such as sign-in and sign-out
23+
* Views of API details, API operation details, and products
24+
* API testing in the interactive test console
25+
26+
> [!NOTE]
27+
> Developer portal usage logs in API Management are currently in preview.
28+
29+
## Enable diagnostic setting for developer portal logs
30+
31+
To configure a diagnostic setting for developer portal usage logs:
32+
33+
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
34+
1. In the left menu, under **Monitoring**, select **Diagnostic settings** > **+ Add diagnostic setting**.
35+
36+
:::image type="content" source="media/developer-portal-enable-usage-logs/monitoring-menu.png" alt-text="Screenshot of adding a diagnostic setting in the portal.":::
37+
1. On the **Diagnostic setting** blade, enter or select details for the setting:
38+
1. **Diagnostic setting name**: Enter a descriptive name.
39+
1. **Category groups**: Optionally make a selection for your scenario.
40+
1. Under **Categories**: Select **Logs related to Developer Portal usage**. Optionally select other categories as needed.
41+
1. Under **Destination details**, select one or more options and specify details for the destination. For example, archive logs to a storage account or stream them to an event hub. [Learn more](../azure-monitor/essentials/diagnostic-settings.md)
42+
> [!NOTE]
43+
> Currently, the **Send to Log Analytics workspace** destination isn't supported for developer portal usage logs.
44+
45+
1. Select **Save**.
46+
47+
## View diagnostic log data
48+
49+
Depending on the log destination you choose, it can take a few minutes for data to appear.
50+
51+
If you send logs to a storage account, you can access the data in the Azure portal and download it for analysis.
52+
53+
1. In the [Azure portal](https://portal.azure.com), navigate to the storage account destination.
54+
1. In the left menu, select **Storage Browser**.
55+
1. Under **Blob containers**, select **insights-logs-developerportalauditlogs**.
56+
1. Navigate to the container for the logs in your API Management instance. The logs are partitioned in intervals of 1 hour.
57+
1. To retrieve the data for further analysis, select **Download**.
58+
59+
60+
## Related content
61+
62+
* [Overview of log queries in Azure Monitor](../azure-monitor/logs/log-query-overview.md).
63+
64+
* [Developer portal audit log schema reference](developer-portal-audit-log-schema-reference.md).
65+

articles/api-management/developer-portal-overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ Learn more about the developer portal:
259259

260260
- [Access and customize the managed developer portal](api-management-howto-developer-portal-customize.md)
261261
- [Extend functionality of the managed developer portal](developer-portal-extend-custom-functionality.md)
262+
- [Enable logging of developer portal usage](developer-portal-enable-usage-logs.md)
262263
- [Set up self-hosted version of the portal](developer-portal-self-host.md)
263264

264265
Browse other resources:

articles/api-management/gateway-log-schema-reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Reference - Azure API Management resource log
3-
description: Schema reference for the Azure API Management GatewayLogs resource log
2+
title: Reference - Azure API Management gateway log
3+
description: Schema reference for the Azure API Management GatewayLogs log. Entries include properties that are logged for each API request.
44
services: api-management
55
author: dlepow
66

77
ms.service: api-management
88
ms.custom: mvc
99
ms.topic: tutorial
10-
ms.date: 10/14/2020
10+
ms.date: 05/14/2024
1111
ms.author: danlep
1212
---
13-
# Reference: API Management resource log schema
13+
# Reference: Gateway log schema
1414

1515
[!INCLUDE [api-management-availability-all-tiers](../../includes/api-management-availability-all-tiers.md)]
1616

@@ -70,4 +70,4 @@ The following properties are logged for each API request.
7070

7171
* For information about monitoring APIs in API Management, see [Monitor published APIs](api-management-howto-use-azure-monitor.md)
7272
* Learn more about [Common and service-specific schema for Azure Resource Logs](../azure-monitor/essentials/resource-logs-schema.md)
73-
73+
* [DeveloperPortalAuditLogs schema reference](developer-portal-audit-log-schema-reference.md)
127 KB
Loading

0 commit comments

Comments
 (0)