| title | Monitor Azure API Management | ||
|---|---|---|---|
| description | Learn how to monitor Azure API Management using Azure Monitor, including data collection, analysis, and alerting. | ||
| ms.date | 09/09/2025 | ||
| ms.custom |
|
||
| ms.topic | how-to | ||
| author | dlepow | ||
| ms.author | danlep | ||
| ms.service | azure-api-management |
[!INCLUDE api-management-availability-all-tiers]
[!INCLUDE azmon-horz-intro]
This table describes how you can collect data to monitor your service, and what you can do with the data once collected:
| Data to collect | Description | How to collect and route the data | Where to view the data | Supported data |
|---|---|---|---|---|
| Metric data | Metrics are numerical values that describe an aspect of a system at a particular point in time. Metrics can be aggregated using algorithms, compared to other metrics, and analyzed for trends over time. | - Collected automatically at regular intervals. - You can route some platform metrics to a Log Analytics workspace to query with other data. Check the DS export setting for each metric to see if you can use a diagnostic setting to route the metric data. |
Metrics explorer | Azure API Management metrics supported by Azure Monitor |
| Resource log data | Logs are recorded system events with a timestamp. Logs can contain different types of data, and be structured or free-form text. You can route resource log data to Log Analytics workspaces for querying and analysis. | Create a diagnostic setting to collect and route resource log data. | Log Analytics | Azure API Management resource log data supported by Azure Monitor |
| Activity log data | The Azure Monitor activity log provides insight into subscription-level events. The activity log includes information like when a resource is modified or a virtual machine is started. | - Collected automatically. - Create a diagnostic setting to a Log Analytics workspace at no charge. |
Activity log |
[!INCLUDE azmon-horz-supported-data]
Azure API management has the following built in monitoring features.
Azure API Management provides analytics for your APIs so that you can analyze their usage and performance. Use analytics for high-level monitoring and troubleshooting of your APIs. For other monitoring features, including near real-time metrics and resource logs for diagnostics and auditing, see Tutorial: Monitor published APIs.
:::image type="content" source="media/howto-use-analytics/analytics-report-portal.png" alt-text="Screenshot of API analytics in the portal." lightbox="media/howto-use-analytics/analytics-report-portal.png":::
[!INCLUDE api-management-workspace-availability]
- API Management provides analytics using an Azure Monitor-based dashboard. The dashboard aggregates data in an Azure Log Analytics workspace.
- In the classic API Management service tiers, your API Management instance also includes legacy built-in analytics in the Azure portal, and analytics data can be accessed using the API Management REST API. Closely similar data is shown in the Azure Monitor-based dashboard and built-in analytics.
Important
- The Azure Monitor-based dashboard is the recommended way to access analytics data.
- Effective March 2027, the dashboard and reports associated with API Management built-in analytics in the classic tiers will be retired. We recommend transitioning to the Azure Monitor-based dashboard that replaces it.
With API analytics, analyze the usage and performance of the APIs in your API Management instance across several dimensions, including:
- Timeline
- Geography
- APIs
- API operations
- Products
- Subscriptions
- Users
- Requests
- Language models (for large language model APIs)
API analytics provides data on requests, including failed and unauthorized requests. Geography values are based on IP address mapping. There can be a delay in the availability of analytics data.
To use the Azure Monitor-based dashboard, you need a Log Analytics workspace as a data source for API Management gateway logs.
If you need to configure one, the following are brief steps to send gateway logs to a Log Analytics workspace. For more information, see Enable diagnostic setting for Azure Monitor logs, later in this article. This procedure is a one-time setup.
-
In the Azure portal, navigate to your API Management instance.
-
In the left-hand menu, under Monitoring, select Diagnostic settings > + Add diagnostic setting.
-
Enter a descriptive name for the diagnostic setting.
-
In Logs, select Logs related to ApiManagement Gateway.
[!TIP] To collect logs for large language model (LLM) APIs for display on the Azure Monitor-based dashboard, also select Logs related to generative AI gateway.
-
In Destination details, select Send to Log Analytics and select a Log Analytics workspace in the same or a different subscription. If you need to create a workspace, see Create a Log Analytics workspace.
-
Make sure Resource specific is selected as the destination table.
-
Select Save.
Important
A new Log Analytics workspace can take up to 2 hours to start receiving data. An existing workspace should start receiving data within approximately 15 minutes.
After a Log Analytics workspace is configured, access the Azure Monitor-based dashboard to analyze the usage and performance of your APIs.
- In the Azure portal, navigate to your API Management instance.
- In the left-hand menu, under Monitoring, select Analytics. The analytics dashboard opens.
- Select a time range for data.
- Select a report category for analytics data, such as Timeline, Geography, and so on.
In certain API Management service tiers, built-in analytics (also called legacy analytics or classic analytics) is also available in the Azure portal, and analytics data can be accessed using the API Management REST API.
To access the built-in (classic) analytics in the Azure portal:
- In the Azure portal, navigate to your API Management instance.
- In the left-hand menu, under Monitoring, select Analytics (classic).
- Select a time range for data, or enter a custom time range.
- Select a report category for analytics data, such as Timeline, Geography, and so on.
- Optionally, filter the report by one or more other categories.
Use Reports operations in the API Management REST API to retrieve and filter analytics data for your API Management instance.
Available operations return report records by API, geography, API operations, product, request, subscription, time, or user.
This section shows you how to enable Azure Monitor logs for auditing and troubleshooting usage of different features of your API Management instance. By enabling a diagnostic setting, you can enable collection of one or more of the following categories of resource logs:
| Category | Description | Notes |
|---|---|---|
| API Management gateway | Requests processed by the API Management gateway, including HTTP methods, protocols, request and response bodies, headers, timings, error details, and cache involvement. | Adjust settings for all APIs, or override them for individual APIs. In API Management instances configured with workspaces, gateway logs can be collected individually for each workspace and aggregated for centralized access by the platform team. |
| WebSocket connections | Events for WebSocket API connections, starting from the handshake until the connection is terminated. | |
| Developer portal usage | Requests that are received and processed by the API Management developer portal, including user authentication actions, views of API details, and API testing in the interactive test console. | |
| Generative AI gateway | Requests processed by the API Management gateway for large language model (LLM) REST APIs such as Microsoft Foundry APIs, including token usage, models, and optionally details of request prompts and response completions. | Enable logging of request messages and/or response messages for specific LLM APIs. |
For more information, see API Management monitoring data reference.
[!INCLUDE api-management-diagnostic-settings]
Depending on the log destination you choose, it can take a few minutes for data to appear.
[!INCLUDE api-management-log-analytics]
If you send logs to a storage account, you can access the data in the Azure portal and download it for analysis.
- In the Azure portal, navigate to the storage account destination.
- In the left menu, select Storage Browser.
- Under Blob containers, select a name for the log data, for example, insights-logs-developerportalauditlogs for developer portal usage logs.
- Navigate to the container for the logs in your API Management instance. The logs are partitioned in intervals of 1 hour.
- To retrieve the data for further analysis, select Download.
[!INCLUDE api-management-api-logging]
[!INCLUDE azmon-horz-tools]
You can use Azure Managed Grafana to visualize API Management monitoring data that is collected into a Log Analytics workspace. Use a prebuilt API Management dashboard for real-time visualization of logs and metrics collected from your API Management instance.
On your API Management instance:
-
To visualize resource logs and metrics for API Management, configure diagnostic settings to collect resource logs and send them to a Log Analytics workspace.
-
To visualize detailed data about requests to the API Management gateway, integrate your API Management instance with Application Insights.
[!NOTE] To visualize data in a single dashboard, configure the Log Analytics workspace for the diagnostic settings and the Application Insights instance in the same resource group as your API Management instance.
On your Managed Grafana workspace:
- To create a Managed Grafana instance and workspace, see the quickstart for the portal or the Azure CLI.
- The Managed Grafana instance must be in the same subscription as the API Management instance.
- When created, the Grafana workspace is automatically assigned a Microsoft Entra managed identity, which is assigned the Monitor Reader role on the subscription. This approach gives you immediate access to Azure Monitor from the new Grafana workspace without needing to set permissions manually. Learn more about configuring data sources for Managed Grafana.
First import the API Management dashboard to your Management Grafana workspace.
To import the dashboard:
- Go to your Azure Managed Grafana workspace. In the portal, on the Overview page of your Managed Grafana instance, select the Endpoint link.
- In the Managed Grafana workspace, go to Dashboards > Browse > Import.
- On the Import page, under Import via grafana.com, enter 16604 and select Load.
- Select an Azure Monitor data source, review or update the other options, and select Import.
To use the API Management dashboard:
- In the Managed Grafana workspace, go to Dashboards > Browse and select your API Management dashboard.
- In the dropdowns at the top, make selections for your API Management instance. If configured, select an Application Insights instance and a Log Analytics workspace.
Review the default visualizations on the dashboard, which appears similar to the following screenshot:
:::image type="content" source="media/visualize-using-managed-grafana-dashboard/api-management-dashboard.png" alt-text="Screenshot of API Management dashboard in Managed Grafana workspace." lightbox="media/visualize-using-managed-grafana-dashboard/api-management-dashboard.png":::
[!INCLUDE azmon-horz-export-data]
[!INCLUDE azmon-horz-kusto]
[!INCLUDE azmon-horz-alerts-part-one]
To see how to set up an alert rule in Azure API Management, see Set up an alert rule.
[!INCLUDE azmon-horz-alerts-part-two]
[!INCLUDE azmon-horz-advisor]