Overview The self-hosted gateway features expand API Management support for multi-cloud environments. You can place the gateway in their Docker, Kubernetes, or any other container orchestration solution which allows customers to optimize traffic flows, security, and compliance. However, you may wonder how to manage related logs and monitoring. Does the admin still need to connect to Azure? In this post, I would like to share how to configure Local logs or Azure API Management self-hosted gateway.
Option 1. Self-hosted gateway output logs to stdout and stderr on the host machine by default.
Check stdout and stderr logs in Kubernetes 1) kubectl get pods: received pods name 2) kubectl logs <pod name>:check stdout and stderr logs
In Docker, the stdout and stderr from each container are stored in /var/lib/docker/containers
In Kubernetes, it creates a directory structure to help you find logs based on Pods. You can find the container logs for each Pod running on a node at /var/log/pods/<namespace>_<pod_name>_<pod_id>/<container_name>/ ref: Logging Architecture | Kubernetes
Option 2. Use additional endpoints to realize local logging trough different protocols
Azure API Management self-hosted gateway also supports a number of protocols including localsyslog, rfc5424, and journal. To realize this feature, you need to mount /dev/log into a container from the host machine. It is because API Management does not log into files, but it logs into Syslog (local or remote), JournalD, or remote UDP endpoint in JSON format.
telemetry.logs.local must be set to localsyslog to enable syslog logging
To log into localsyslog - mount /dev/log from container host into the container.
To log into remote Syslog - specify UDP endpoint instead.
To log into journal - mount /var/run/systemd/journal/socket. To make localsyslog/journal work, you must mount host sockets into API Management ‘s container.
To log into fluentd - specify remote UDP endpoint.
Sample yaml file: Below is a complete sample yaml file for localsyslog