Επεξεργασία

Κοινή χρήση μέσω


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

APPLIES TO: Developer | Premium

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.

Metrics

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 telemetry.metrics.cloud key in the ConfigMap of the gateway Deployment. Below is a breakdown of the available configurations:

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

Here is a sample configuration:

    apiVersion: v1
    kind: ConfigMap
    metadata:
        name: contoso-gateway-environment
    data:
        config.service.endpoint: "<contoso-gateway-management-endpoint>"
        telemetry.metrics.cloud: "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)

Logs

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