Skip to main content

Version: latest

Centralized Logging

API7 Gateway produces several types of logs that are essential for debugging and operating the platform. For production environments, forward these logs to a centralized log management system such as Elasticsearch, Splunk, or AWS CloudWatch.

Log types and locations

Data plane logs

The data plane writes both an error log and an access log. With the official container images, both files live under /usr/local/apisix/logs/:

Log typeDescriptionDefault path
Error logGateway startup events, plugin errors, upstream failures, and core errors./usr/local/apisix/logs/error.log
Access logOne line per request processed by the gateway./usr/local/apisix/logs/access.log

If you run the data plane outside the official images, the actual paths depend on your installation prefix. Both paths are configurable in config.yaml — see Configure log files below.

Control plane logs

The control plane (Dashboard and DP Manager) emits structured logs to standard output of the corresponding container. Use your container runtime to inspect them, for example:

docker logs <api7-ee-dashboard-container>
docker logs <api7-ee-dp-manager-container>

Administrative changes (configuration created/updated/deleted, login activity, role changes) are recorded separately in the audit log, which is viewable in the Dashboard.

Configure log files

The following keys in the data plane's config.yaml control where logs are written and how verbose the error log is:

conf/config.yaml
nginx_config:
error_log: logs/error.log
error_log_level: warn # debug, info, notice, warn, error, crit, alert, emerg
http:
enable_access_log: true
access_log: logs/access.log
access_log_format: '$remote_addr - $remote_user [$time_local] $http_host "$request_line" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $upstream_addr $upstream_status $upstream_response_time "$apisix_request_id"'
access_log_format_escape: default # default or json

Relative paths are resolved against the gateway's installation prefix (/usr/local/apisix in the official images).

After changing any of these values, reload or restart the gateway for the new configuration to take effect.

Use a JSON access log format

For easier parsing by log shippers, set a JSON access log format and switch escaping to json:

conf/config.yaml
nginx_config:
http:
access_log_format: '{"time_local":"$time_local","remote_addr":"$remote_addr","status":"$status","request_time":"$request_time","upstream_status":"$upstream_status","request":"$request"}'
access_log_format_escape: json

To include consumer labels in each access log line, see Log Consumer Labels in Access Log.

Forward logs to a centralized system

You have two complementary options:

Next steps

API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2026. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation