Configuring Log Settings¶
Log configuration for all Knative components is managed through the config-logging
ConfigMap in the corresponding namespace. For example, Serving components are configured through config-logging
in the knative-serving
namespace and Eventing components are configured through config-logging
in the knative-eventing
namespace, etc.
Knative components use the zap logging library; options are documented in more detail in that project.
In addition to zap-logger-config
, which is a general key that applies to all components in that namespace, the config-logging
ConfigMap supports overriding the log level for individual components.
ConfigMap key | Description |
---|---|
zap-logger-config |
A JSON object container for a zap logger configuration. Key fields are highlighted below. |
zap-logger-config.level |
The default logging level for components. Messages at or above this severity level will be logged. |
zap-logger-config.encoding |
The log encoding format for component logs (defaults to JSON). |
zap-logger-config.encoderConfig |
A zap EncoderConfig used to customize record contents. |
loglevel.<component> |
Overrides logging level for the given component only. Messages at or above this severity level will be logged. |
Log levels supported by Zap are:
debug
- fine-grained debugginginfo
- normal loggingwarn
- unexpected but non-critical errorserror
- critical errors; unexpected during normal operationdpanic
- in debug mode, trigger a panic (crash)panic
- trigger a panic (crash)fatal
- immediately exit with exit status 1 (failure)