You are browsing documentation for an outdated version. See the latest documentation here.

Dynamic Log Level Updates

You can change the log level of Kong Gateway dynamically, without restarting Kong Gateway, using the Admin API. This set of endpoints can be protected using RBAC and changes in log level are reflected in the audit log.

The log level change is propagated to all NGINX worker nodes, including the newly spawned workers.

Be careful when changing the log level of a node to debug in a production environment, because the disk could fill up quickly. As soon as the debug logging finishes, revert back to a higher level such as notice.

View current log level

To view the log level of an individual node, issue a GET request passing the desired node as a path parameter:

  1. curl --request GET \
  2. --url http://localhost:8001/debug/node/log-level/

If you have the appropriate permissions, this request returns information about your current log level:

  1. {
  2. "message": "log level: notice"
  3. }

It is currently not possible to change the log level of the data plane or DB-less nodes.

Modify the log level for an individual Kong Gateway node

To change the log level of an individual node, issue a PUT request passing the desired node and log-level as path parameters:

  1. curl --request PUT \
  2. --url http://localhost:8001/debug/node/log-level/notice

If you have the appropriate permissions and the request is successful, you receive a 200 response code and the following response body:

  1. {
  2. "message": "log level changed"
  3. }

Change the log level of the Kong Gateway cluster

To change the log level of every node in your cluster, issue a PUT request with the desired log-level specified as a path parameter:

  1. curl --request PUT \
  2. --url http://localhost:8001/debug/cluster/log-level/notice

If you have the appropriate permissions and the request is successful, you receive a 200 response code and the following response body:

  1. {
  2. "message": "log level changed"
  3. }

Manage new nodes in the cluster

To ensure that the log level of new nodes that are added to the cluster remain in sync the other nodes in the cluster, change the log_level entry in kong.conf to KONG_LOG_LEVEL. This setting allows new nodes to join the cluster with the same log level as all existing nodes.

Change the log level of all control plane Kong Gateway nodes

To change the log level of the control plane nodes in your cluster, issue a PUT request with the desired log-level specified as a path parameter:

  1. curl --request PUT \
  2. --url http://localhost:8001/debug/cluster/control-planes-nodes/log-level/notice

If you have the appropriate permissions and the request is successful, you receive a 200 response code and the following response body:

  1. {
  2. "message": "log level changed"
  3. }