Enable debug logging

Deployment Platform
Related Documentation
Related Resources
TL;DR

Configure the zap-log-level and zap-devel environment variables via Helm values.

Enable debug logging

When installing or upgrading Kong Operator with Helm, you can enable debug logging by adding the following to your values.yaml:

cat <<EOF > values.yaml
env:
  zap_log_level: debug
  zap_devel: "true"
  zap_time_encoding: iso8601
EOF

For more details about these options, see Kong Operator configuration options.

Install Kong Operator

Run the following command to install Kong Operator using the values.yaml file we created:

helm upgrade --install kong-operator kong/kong-operator -n kong-system \
  --create-namespace \
  --set image.tag=2.1.0 \
  --set env.ENABLE_CONTROLLER_KONNECT=true \
  -f values.yaml
helm upgrade --install kong-operator kong/kong-operator -n kong-system \
  --create-namespace \
  --set image.tag=2.1.0 \
  -f values.yaml

Validate

Use the following command to display the Kong Operator logs:

kubectl logs -n kong-system deployment/kong-operator-kong-operator-controller-manager -f

You should see logs with the DEBUG level.

Development mode (--zap-devel=true) uses a console encoder with colored, human-readable output. Production mode uses JSON encoding suitable for log aggregation systems.

FAQs

To return to normal logging levels, remove the debug configuration and upgrade:

helm upgrade kong-operator kong/kong-operator \
  -n kong-system \
  --reset-values

Yes, you can configure logging using flags in your values.yaml:

args:
  - --zap-log-level=debug
  - --zap-devel=true
  - --zap-time-encoding=iso8601

The env and args sections are mutually exclusive. When both are provided, args takes precedence.

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!