Ensure beats receivers log the same metadata as beats processes #8606
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in./changelog/fragments
using the changelog toolHow 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