Skip to content

Conversation

andrzej-stencel
Copy link
Contributor

Proposed commit message

Add add_host_metadata processor to the OpenTelemetry Beat processor

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.
    • I didn't add a changelog entry as the processor is not ready for public use

How to test this PR locally

  1. Include the processor in Elastic Agent by adding it to https://github.com/elastic/elastic-agent/blob/89e0e9a5b0ebb376773de813a1fd2c0b2f30e74a/internal/pkg/otel/components.go.
  2. Build the Elastic Agent
  3. Run the Agent with an OTel config that includes the Beat processor.

Example OTel config:

service:
  pipelines:
    logs:
      receivers:
        - filebeatreceiver
      processors:
        - beat
      exporters:
        - debug

receivers:
  filebeatreceiver:
    filebeat:
      inputs:
        - type: filestream
          paths:
            - /tmp/logs-1k.log
    processors:
      # Configure a processor to prevent enabling default processors
      - add_fields:
          fields:
            custom_field: "custom_value"
    output:
      otelconsumer:
    path.data: /tmp/0819/data
    path.logs: /tmp/0819/logs
    queue.mem:
      flush.timeout: 0

processors:
  beat:
    processors:
      - add_host_metadata:
          netinfo:
            enabled: false

exporters:
  debug:
    use_internal_logger: false
    verbosity: normal

This is a manual backport of pull request #46112 done by @andrzej-stencel

* add `add_host_metadata` processor

* add integration test

* test: add assertion messages

* test: simplify integration test by removing filebeat monitoring

* docs: mention the default processors in Beat receivers

* test: add tests for `createProcessor` function
@andrzej-stencel andrzej-stencel requested a review from a team as a code owner October 8, 2025 12:14
@andrzej-stencel andrzej-stencel requested review from AndersonQ and VihasMakwana and removed request for a team October 8, 2025 12:14
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 8, 2025
@andrzej-stencel andrzej-stencel changed the title [9.2](backport #46112) Add host processor to Beat processor [9.1](backport #46112) Add host processor to Beat processor Oct 8, 2025
Copy link
Contributor

github-actions bot commented Oct 8, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@andrzej-stencel andrzej-stencel added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Oct 8, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 8, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@mauri870 mauri870 enabled auto-merge (squash) October 14, 2025 14:18
@mauri870 mauri870 marked this pull request as draft October 14, 2025 14:59
auto-merge was automatically disabled October 14, 2025 14:59

Pull request was converted to draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants