From 8fed0a9c013b26126888104024a572db63c4c81b Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Wed, 5 Sep 2018 03:57:07 -0400 Subject: [PATCH] Fix a race condition with the add_host_metadata processor (#8223) (#8225) Fix a race between updating the host data structure and the serialization of events to json. closes #8040 (cherry picked from commit 415715d5e7e63fa89c08976e1454686ea5963a6d) --- CHANGELOG.asciidoc | 1 + libbeat/processors/add_host_metadata/add_host_metadata.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index e0a3632cf48..97b6b684109 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -42,6 +42,7 @@ https://github.com/elastic/beats/compare/v6.4.0...6.4[Check the HEAD diff] - Replace index patterns in TSVB visualizations. {pull}7929[7929] - Add backoff support to x-pack monitoring outputs. {issue}7966[7966] - Removed execute permissions systemd unit file. {pull}7873[7873] +- Fix a race condition with the `add_host_metadata` and the event serialization. {pull}8223[8223] *Auditbeat* diff --git a/libbeat/processors/add_host_metadata/add_host_metadata.go b/libbeat/processors/add_host_metadata/add_host_metadata.go index c4742af81b8..f9597cb79f2 100644 --- a/libbeat/processors/add_host_metadata/add_host_metadata.go +++ b/libbeat/processors/add_host_metadata/add_host_metadata.go @@ -70,7 +70,7 @@ func newHostMetadataProcessor(cfg *common.Config) (processors.Processor, error) // Run enriches the given event with the host meta data func (p *addHostMetadata) Run(event *beat.Event) (*beat.Event, error) { p.loadData() - event.Fields.DeepUpdate(p.data) + event.Fields.DeepUpdate(p.data.Clone()) return event, nil }