From 9a4df8b96bd96fe27c94e758150e2a4e3ccab593 Mon Sep 17 00:00:00 2001 From: Igor Peshansky Date: Thu, 4 Jul 2024 03:03:29 -0400 Subject: [PATCH 1/4] [otelcol] Tell all loggers to encode timestamps in ISO8601. --- otelcol/collector_windows.go | 1 + 1 file changed, 1 insertion(+) diff --git a/otelcol/collector_windows.go b/otelcol/collector_windows.go index 3df08386bbf..04e99387fb5 100644 --- a/otelcol/collector_windows.go +++ b/otelcol/collector_windows.go @@ -214,6 +214,7 @@ func withWindowsCore(elog *eventlog.Log, serviceConfig **service.Config) func(za // Use the Windows Event Log encoderConfig := zap.NewProductionEncoderConfig() encoderConfig.LineEnding = "\r\n" + encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder return windowsEventLogCore{core, elog, zapcore.NewConsoleEncoder(encoderConfig)} } } From fac4ab4839189ec23ab680f8e308b0f9559eb918 Mon Sep 17 00:00:00 2001 From: Igor Peshansky Date: Thu, 4 Jul 2024 03:03:47 -0400 Subject: [PATCH 2/4] [service] Tell all loggers to encode timestamps in ISO8601. --- service/telemetry/logger.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/telemetry/logger.go b/service/telemetry/logger.go index eb675bc459f..63f8f3c558d 100644 --- a/service/telemetry/logger.go +++ b/service/telemetry/logger.go @@ -10,11 +10,13 @@ import ( func newLogger(cfg LogsConfig, options []zap.Option) (*zap.Logger, error) { // Copied from NewProductionConfig. + ec := zap.NewProductionEncoderConfig() + ec.EncodeTime = zapcore.ISO8601TimeEncoder zapCfg := &zap.Config{ Level: zap.NewAtomicLevelAt(cfg.Level), Development: cfg.Development, Encoding: cfg.Encoding, - EncoderConfig: zap.NewProductionEncoderConfig(), + EncoderConfig: ec, OutputPaths: cfg.OutputPaths, ErrorOutputPaths: cfg.ErrorOutputPaths, DisableCaller: cfg.DisableCaller, From 25244ea5a445b621f58ee188012f3a9d303634f2 Mon Sep 17 00:00:00 2001 From: Igor Peshansky Date: Wed, 7 Aug 2024 17:15:56 -0400 Subject: [PATCH 3/4] Add changelog entry. --- ...orpeshansky-windows-logger-timestamps.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .chloggen/igorpeshansky-windows-logger-timestamps.yaml diff --git a/.chloggen/igorpeshansky-windows-logger-timestamps.yaml b/.chloggen/igorpeshansky-windows-logger-timestamps.yaml new file mode 100644 index 00000000000..b2bb53a81d1 --- /dev/null +++ b/.chloggen/igorpeshansky-windows-logger-timestamps.yaml @@ -0,0 +1,28 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: otelcol + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change all logged timestamps to ISO8601. + +# One or more tracking issues or pull requests related to the change +issues: [] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: |- + This makes log timestamps human-readable (as opposed to epoch seconds in + scientific notation), but may break users trying to parse logged lines in the + old format. + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] From dab04e0c2502dd9cf7d5b5dfb8fb1aebf6c7d145 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Thu, 8 Aug 2024 06:56:25 -0500 Subject: [PATCH 4/4] Update .chloggen/igorpeshansky-windows-logger-timestamps.yaml --- .chloggen/igorpeshansky-windows-logger-timestamps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/igorpeshansky-windows-logger-timestamps.yaml b/.chloggen/igorpeshansky-windows-logger-timestamps.yaml index b2bb53a81d1..f41e95ee95a 100644 --- a/.chloggen/igorpeshansky-windows-logger-timestamps.yaml +++ b/.chloggen/igorpeshansky-windows-logger-timestamps.yaml @@ -10,7 +10,7 @@ component: otelcol note: Change all logged timestamps to ISO8601. # One or more tracking issues or pull requests related to the change -issues: [] +issues: [10543] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document.