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.
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
Add
logging.with_fields
to beatreceiver config #42961Add
logging.with_fields
to beatreceiver config #42961Changes from 10 commits
76d74c2
863fc72
c5ef3ef
9e0aefe
c144433
c62bf6d
8634ad4
21e2555
f839834
589f641
28403f4
c9a394d
2765f2d
57d4f45
528ea82
c6d6114
e657823
24df137
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this works, but I'm wondering why
logp.ConfigureWithCore
isn't doing this? It is the logp config that has the option, I would just expect it to happen there, much like the selectors get set there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, you are right. I will raise close this and open a separate PR on elastic-agent-libs. Thank you for pointing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to write a test that ensures setting this produces logs with the expected fields. There are several system tests that run a beat and inspect the log files you could look at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is restricted to beatreceivers - will use the existing tests in elastic-agent to ensure this setting.
Related PR on elastic-agent: elastic/elastic-agent#7062
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a Beats specific change in beat.go, it doesn't make sense to me to test it in agent because a PR in agent could never break this.
Agent will rely on this feature, but the elastic agent repository shouldn't be responsible for testing that it works on its own.
One way to think about this is a series of contracts that must be upheld:
logging.with_fields
is set. You can specifically test that thecomponent
fields can be injected here.logging.with_fields
configuration of each beat receiver when its own log level changes.Those two things tested independently should guarantee this works properly.