#53388·beats

[otel-beatreceiver-isolation] Receiver hostname config leaks via process-wide override across BeatReceivers

Author: github-actions[bot]Created Sep 24, 2026Updated Sep 28, 2026
LabelsTeam:Elastic-Agent-Data-Plane

Findings

1. Receiver-local hostname config mutates process-global hostname override used by all receivers

Severity: High

Location

  • x-pack/libbeat/cmd/instance/beat.go:181
  • libbeat/cmd/instance/beat.go:820-826
  • libbeat/beat/info.go:32,36,46
  • libbeat/publisher/processing/default.go:152-153
  • libbeat/processors/add_host_metadata/add_host_metadata.go:222
  • libbeat/processors/add_observer_metadata/add_observer_metadata.go:125
  • Receiver paths that enable host metadata processing:
    • x-pack/filebeat/fbreceiver/factory.go:39
    • x-pack/metricbeat/mbreceiver/factory.go:45

Evidence

  • Receiver construction applies hostname from config:
    • b.ApplyHostname(b.Config.Hostname, "config hostname field") (x-pack/libbeat/cmd/instance/beat.go:181)
  • ApplyHostname explicitly writes process-wide state:
    • beat.SetHostnameOverride(h) (libbeat/cmd/instance/beat.go:824)
    • comment: updates the process-wide hostname override (libbeat/cmd/instance/beat.go:818)
  • Global storage is package-level singleton:
    • var hostnameOverride atomic.Pointer[string] (libbeat/beat/info.go:32)
  • Multiple runtime paths for event metadata read the same global override:
    • if override := beat.GetHostnameOverride(); override != "" { ... } (libbeat/publisher/processing/default.go:152-153, libbeat/processors/add_host_metadata/add_host_metadata.go:222)
    • hostname := beat.GetHostnameOverride() (libbeat/processors/add_observer_metadata/add_observer_metadata.go:125)

What is wrong hostname appears receiver-local in BeatReceiver config, but constructor writes it into a process-global singleton. In a single OTel Collector process with multiple BeatReceivers, one receiver’s hostname setting can silently affect other receivers.

Why it matters This causes cross-receiver identity corruption (host.name / observer hostname fields). In multi-receiver deployments or receiver restarts/reloads, unrelated pipelines can emit events with the wrong host identity, breaking attribution and downstream routing/analysis assumptions.

Suggested fix direction

  1. Stop calling process-wide beat.SetHostnameOverride from BeatReceiver constructor flow.
  2. Carry hostname override in receiver/beat instance state and plumb it into processor/builtin field generation using instance-local values.
  3. Add regression tests that construct two receivers in one process with conflicting hostname values and assert independent emitted host.name / observer hostname.

Safe / already tracked context

During this sweep, previously reported global-state problems (config resolver overwrite, timestamp precision global mutation, feature flag global mutation, and filebeat initialization map-write races) were re-confirmed as already tracked by open issues and are not duplicated here.


What is this? | From workflow: Sweeper: OTel BeatReceiver Global State Isolation

Give us feedback! React with if perfect, if helpful, if not.

  • expires on Oct 1, 2026, 9:39 AM UTC