Skip to content

Commit 7258abd

Browse files
authored
Fix OnBrokerConnect log field conflict (#726)
- Fix `host` field conflict with logging pipeline. Change to destination.domain for ECS compliance. - Update `port` to `destination.port` - Add `node_id` and `rack` - Change `event.duration` to be nanos for ECS compliance
1 parent b8dc0d8 commit 7258abd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kafka/logger.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ func (l *loggerHook) OnBrokerConnect(meta kgo.BrokerMetadata, dialDur time.Durat
3939
if err != nil {
4040
fields := []zap.Field{
4141
zap.Error(err),
42-
zap.Duration("event.duration", dialDur),
43-
zap.String("host", meta.Host),
44-
zap.Int32("port", meta.Port),
42+
zap.Int64("event.duration", dialDur.Nanoseconds()),
43+
zap.String("destination.domain", meta.Host),
44+
zap.Int32("destination.port", meta.Port),
45+
zap.Int32("node_id", meta.NodeID),
46+
zap.Stringp("rack", meta.Rack),
4547
zap.Stack("stack"),
4648
}
4749
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {

0 commit comments

Comments
 (0)