Configuring Logging ​
Learn how to configure logging for Keda Manager and the Keda module components.
Prerequisites ​
You have kubectl installed.
Supported Log Levels ​
From the least to the most verbose: fatal, panic, dpanic, error, warn, info (default), debug.
Supported Log Formats ​
The supported log formats are the following:
json- Structured JSON format (default)console(ortext) - Human-readable console format
Configure Keda Manager Logging ​
The Keda manager (keda-manager) supports dynamic log-level reconfiguration using a ConfigMap. Changes take effect without requiring a Pod restart.
To change the log level, run:
bashkubectl patch configmap keda-log-configmap -n kyma-system --type merge -p '{"data":{"log-config.yaml":"logLevel: debug"}}'To change the log level and format, run:
bashkubectl patch configmap keda-log-configmap -n kyma-system --type merge -p '{"data":{"log-config.yaml":"logLevel: debug\nlogFormat: json"}}'To verify the change, run:
bashkubectl logs -n kyma-system -l app.kubernetes.io/name=keda-manager
Configure Keda Module Components Logging ​
NOTE
Modifying the logging configuration of the operator, metrics-server, and admission-webhooks components triggers a restart to apply the new settings.
Supported Time Encodings ​
The supported time encodings are the following:
rfc3339- RFC3339 format (default):2006-01-02T15:04:05Z07:00rfc3339nano- RFC3339 with nanoseconds:2006-01-02T15:04:05.999999999Z07:00iso8601- ISO8601 format:2006-01-02T15:04:05.000Z0700epoch- Unix timestamp in secondsmillis- Unix timestamp in millisecondsnano- Unix timestamp in nanoseconds
Configuration ​
Update the Keda custom resource to configure logging for KEDA components:
apiVersion: operator.kyma-project.io/v1alpha1
kind: Keda
metadata:
name: default
namespace: kyma-system
spec:
logging:
operator:
level: "debug"
format: "json"
timeEncoding: "rfc3339"
metricServer:
level: "info"
format: "json"
timeEncoding: "rfc3339"
admissionWebhook:
level: "info"
format: "json"
timeEncoding: "rfc3339"NOTE
The zap logger used by the Keda module components (operator, metrics-apiserver, admission-webhooks) has fixed field names in JSON format that cannot be customized: level, ts, logger, msg, caller.
Verify the Changes ​
To check the
keda-operatorlogs, run:bashkubectl logs -n kyma-system -l app=keda-operatorTo check the
keda-metrics-apiserverlogs, run:bashkubectl logs -n kyma-system -l app=keda-operator-metrics-apiserverTo check the
keda-admission-webhookslogs, run:bashkubectl logs -n kyma-system -l app=keda-admission-webhooks
Limitations ​
The klog logs (Kubernetes API server framework) used by keda-operator-metrics-apiserver are always in text format, prefixed with I, W, E for Info, Warning, and Error:
I0203 12:03:29.253333 1 requestheader_controller.go:180] Starting RequestHeaderAuthRequestController <- Actual log line
W0203 11:39:56.585970 1 this is a warning example
E0203 11:39:56.586030 1 this is an error exampleRelated Information ​
For more details about KEDA resources and configuration, see: