diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a9cba9e46d32..deeb1364f8ab 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -43,6 +43,8 @@ https://github.com/elastic/beats/compare/v6.5.0...6.5[Check the HEAD diff] *Metricbeat* +- Fix race condition when enriching events with kubernetes metadata. {issue}9055[9055] {issue}9067[9067] + *Packetbeat* *Winlogbeat* diff --git a/metricbeat/module/kubernetes/util/kubernetes.go b/metricbeat/module/kubernetes/util/kubernetes.go index 43cbbc25f9a9..8047e08bbb08 100644 --- a/metricbeat/module/kubernetes/util/kubernetes.go +++ b/metricbeat/module/kubernetes/util/kubernetes.go @@ -294,6 +294,8 @@ func (m *enricher) Stop() { } func (m *enricher) Enrich(events []common.MapStr) { + m.RLock() + defer m.RUnlock() for _, event := range events { if meta := m.metadata[m.index(event)]; meta != nil { event.DeepUpdate(common.MapStr{