Skip to content

Conversation

@mauri870
Copy link
Member

Proposed commit message

Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats.

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.

Related issues

Beats receivers currently use the hostname as the "service.name" logger
field. Adjust it to reflect the beat name for consistency with standard
beats.
@mauri870 mauri870 self-assigned this Jun 16, 2025
@mauri870 mauri870 added cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-9.0 Automated backport to the 9.0 branch backport-8.19 Automated backport to the 8.19 branch labels Jun 16, 2025
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jun 16, 2025
@github-actions
Copy link
Contributor

🤖 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!)

@mauri870 mauri870 requested a review from Copilot June 16, 2025 14:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the service.name logger field for Beats receivers to use the beat name instead of the hostname.

  • Added a new Beat field to the ReceiverConfig struct and tests
  • Updated logpConfig.Beat to reference Info.Beat instead of Info.Name
  • Extended OTEL test helpers to validate and assert the new service.name field

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
x-pack/metricbeat/mbreceiver/receiver_test.go Added Beat: "metricbeat" to test receiver configurations
x-pack/filebeat/fbreceiver/receiver_test.go Added Beat: "filebeat" to test receiver configurations
x-pack/libbeat/cmd/instance/beat.go Changed logpConfig.Beat assignment to use b.Info.Beat
libbeat/otelbeat/oteltest/oteltest.go Introduced Beat field, validation, helper, and assertions
Comments suppressed due to low confidence (3)

libbeat/otelbeat/oteltest/oteltest.go:44

  • [nitpick] Consider adding a comment for the Config field to match the style of other struct field comments.
Config component.Config

libbeat/otelbeat/oteltest/oteltest.go:138

  • [nitpick] The function name beatForCompID is terse; consider renaming to getBeatForComponentID or resolveBeatByComponentID for clarity.
beatForCompID := func(compID string) string {

x-pack/libbeat/cmd/instance/beat.go:113

  • Ensure project and user-facing documentation is updated to reflect that logpConfig.Beat now uses Info.Beat instead of Info.Name.
logpConfig.Beat = b.Info.Beat

@mauri870 mauri870 marked this pull request as ready for review June 16, 2025 17:29
@mauri870 mauri870 requested a review from a team as a code owner June 16, 2025 17:29
@mauri870 mauri870 requested review from faec and leehinman June 16, 2025 17:29
@elasticmachine
Copy link
Contributor

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

@mauri870 mauri870 merged commit df3dcad into elastic:main Jun 17, 2025
202 checks passed
mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* otel: fix service.name for beats receivers

Beats receivers currently use the hostname as the "service.name" logger
field. Adjust it to reflect the beat name for consistency with standard
beats.

* use require.Contains before Equal

* fix linter issues

(cherry picked from commit df3dcad)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* otel: fix service.name for beats receivers

Beats receivers currently use the hostname as the "service.name" logger
field. Adjust it to reflect the beat name for consistency with standard
beats.

* use require.Contains before Equal

* fix linter issues

(cherry picked from commit df3dcad)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mauri870 added a commit that referenced this pull request Jun 17, 2025
…44863)

* otel: fix service.name for beats receivers (#44831)

* otel: fix service.name for beats receivers

Beats receivers currently use the hostname as the "service.name" logger
field. Adjust it to reflect the beat name for consistency with standard
beats.

* use require.Contains before Equal

* fix linter issues

(cherry picked from commit df3dcad)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

* fix conflicts

---------

Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
mauri870 added a commit that referenced this pull request Jun 17, 2025
…4864)

* otel: fix service.name for beats receivers (#44831)

* otel: fix service.name for beats receivers

Beats receivers currently use the hostname as the "service.name" logger
field. Adjust it to reflect the beat name for consistency with standard
beats.

* use require.Contains before Equal

* fix linter issues

(cherry picked from commit df3dcad)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

* fix conflicts

---------

Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
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 backport-9.0 Automated backport to the 9.0 branch cleanup 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.

Beats receivers should emit the same log attributes as beats processes

4 participants