Skip to content

Ensure beats receivers log the same metadata as beats processes #8606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Jun 20, 2025

What does this PR do?

It ensures logs from beats receivers forwarded by elastic-agent have the same metadata as ones from beats processes. It's worth noting they aren't identical, as beats receiver logs currently have the following additional attributes:

  • otelcol.component.id
  • otelcol.component.kind
  • otelcol.signal
  • resource

Whether these should exist as they are is a separate issue. This PR is only concerned with the backwards compatibility of beats receiver logs relative to beats process logs.

The only semantic change in this PR is passing the base logger to the Otel Collector instead of the elastic-agent logger. This is consistent with what we do for beats processes.

I've also added a test that compares a specifically chosen log line between beats receivers and processes without sending it to Elasticsearch. My intent was to verify the metadata before it goes through any processing pipelines, be they local or remote.

Why is it important?

Beats receivers should be as similar to beats processes as possible in all of their external outputs. Some of the log messages are different during startup, as it uses different code paths, but most of them are identical. More importantly, the metadata used to query these logs in ES must be identical.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

Build agent locally, run it with two identical inputs using different runtimes. Observe that the emitted logs are compatible.

Related issues

@swiatekm swiatekm added bug Something isn't working skip-changelog backport-8.19 Automated backport to the 8.19 branch labels Jun 20, 2025
@swiatekm swiatekm force-pushed the fix/otel-runtime-logging branch from d685556 to f58cb36 Compare June 20, 2025 17:41
Copy link

@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @swiatekm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.19 Automated backport to the 8.19 branch bug Something isn't working skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants