From a9754d6a1c994801a44a2ccad9d7bd0c15088569 Mon Sep 17 00:00:00 2001 From: Hector Zarate Date: Wed, 26 Mar 2025 10:28:58 +0100 Subject: [PATCH] fix(logging): correctly map GCP structured log keys (#1159) * fix: correctly map GCP structured log keys * Update pkg/modules/logging/logging.go Co-authored-by: Julien Neuhart --------- Co-authored-by: Julien Neuhart --- pkg/modules/logging/logging.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/modules/logging/logging.go b/pkg/modules/logging/logging.go index 36fc1ae2..e2526038 100644 --- a/pkg/modules/logging/logging.go +++ b/pkg/modules/logging/logging.go @@ -198,6 +198,12 @@ func newLogEncoder(format string, gcpSeverity bool) (zapcore.Encoder, error) { if gcpSeverity { encCfg.EncodeLevel = gcpSeverityEncoder + // Those only make sense in JSON. + encCfg.TimeKey = "time" + encCfg.LevelKey = "severity" + encCfg.MessageKey = "message" + encCfg.EncodeTime = zapcore.ISO8601TimeEncoder + encCfg.EncodeDuration = zapcore.MillisDurationEncoder } }