Configure cloud metrics and logs for Azure API Management self-hosted gateway

This article provides details for configuring cloud metrics and logs for the self-hosted gateway.

The self-hosted gateway has to be associated with an API management service and requires outbound TCP/IP connectivity to Azure on port 443. The gateway leverages the outbound connection to send telemetry to Azure, if configured to do so.



This feature is available in the Premium and Developer tiers of API Management.

For feature availability in the v2 tiers (preview), see the v2 tiers overview.


By default, the self-hosted gateway emits a number of metrics through Azure Monitor, same as the managed gateway in the cloud.

The feature can be enabled or disabled using the key in the ConfigMap of the gateway Deployment. Below is a breakdown of the available configurations:

Field Default Description true Enables logging through Azure Monitor. Value can be true, false.

Here is a sample configuration:

    apiVersion: v1
    kind: ConfigMap
        name: contoso-gateway-environment
        config.service.endpoint: "<contoso-gateway-management-endpoint>" "true"

The self-hosted gateway currently emits the following metrics through Azure Monitor:

Metric Description
Requests Number of API requests in the period
Duration of gateway requests Number of milliseconds from the moment gateway received request until the moment response sent in full
Duration of backend requests Number of milliseconds spent on overall backend IO (connecting, sending and receiving bytes)


The self-hosted gateway currently does not send diagnostic logs to the cloud. However, it is possible to configure and persist logs locally where the self-hosted gateway is deployed.

If a gateway is deployed in Azure Kubernetes Service, you can enable Azure Monitor for containers to collect logs from your containers and view them in Log Analytics.

Next steps