Elastic-Agent duplicates log.level
from its sub components if they're not compatible with zap.
#4559
Labels
log.level
from its sub components if they're not compatible with zap.
#4559
When the Elastic-Agent reads a line written to stderr or stdout by a process it's running, it tries to parse it as JSON, then it tries to extract the log level from the key
log.level
. The value is then passed toUnmarshalText
fromzapcore.Level
. If this call returns an error, thelog.level
key is left in the JSON and when the entry is logged the Elastic-Agent logger for that process will also add it's ownlog.level
key, ending on a duplication.The JSON is handled here
elastic-agent/pkg/component/runtime/log_writer.go
Lines 125 to 152 in 87336db
getLevel
elastic-agent/pkg/component/runtime/log_writer.go
Lines 154 to 161 in 87336db
unmarshalLevel
elastic-agent/pkg/component/runtime/log_writer.go
Lines 163 to 172 in 87336db
zapcore.Level.UnmarshalText
elastic-agent/pkg/component/runtime/log_writer.go
Line 171 in 87336db
If the parsing errors, then the
log.level
is not removed from the JSONelastic-agent/pkg/component/runtime/log_writer.go
Lines 157 to 159 in 87336db
log.level
as zap will always add it to the final log entry.The text was updated successfully, but these errors were encountered: