-
Notifications
You must be signed in to change notification settings - Fork 154
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 conditions to copy_fields processor #6730
base: main
Are you sure you want to change the base?
Conversation
This pull request does not have a backport label. Could you fix it @belimawr? 🙏
|
This commit adds conditions to the `copy_fields` processor from the monitoring Filebeat to prevent it from failing and spamming the event logger at debug level with: `target field xxx already exists, drop or rename this field first`
fdc8a60
to
3fa11af
Compare
@@ -128,7 +128,7 @@ func startMockES(t *testing.T) string { | |||
uid, | |||
clusterUUID, | |||
nil, | |||
time.Now().Add(time.Hour), 0, 0, 0, 100, 0)) | |||
time.Now().Add(time.Hour), 0, 0, 0, 0, 0)) |
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 causes the mock to accept all the events, instead of returning an error. The test that relied on the error has been updated.
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
…-coppy_fields-processor
I looked at the test failures, they seem unrelated to the PR, likely some flakiness communicating with the Elastic-Agent during the test. |
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.
@belimawr could you write some unit-tests around that to increase the coverage?
I can if you insist. The only unit test for it is to test if the conditions are introduced to the policy, but not their effectiveness. I'd test something very generic like: "all I'm not convinced that this is what we want to enforce. There is an integration test that ensures the correct behaviour: we do not spam our logs with "failed processors" message from processors we control and can avoid their failure. What do you think? |
I kinda see multiple reasons to have unit-tests:
now if you insist on not writing any, I am not here to enforce anything 🙂 |
@pkoutsovasilis I tried the |
hmmm that is really interesting 🤔 could you please create an issue with your findings to not lose track of such behaviour. Also I did notice the build failures and this is related to the unit-test of actually my own PR that got merged yesterday. I have opened a PR that mitigates this failures here but you would have once more to merge main when this goes in |
@pkoutsovasilis here is the issue: #6820 |
…-coppy_fields-processor
…/elastic-agent into 5299-fix-coppy_fields-processor
|
What does this PR do?
This commit adds conditions to the
copy_fields
processor from the monitoring Filebeat to prevent it from failing and spamming the event logger at debug level with:target field xxx already exists, drop or rename this field first
Why is it important?
It makes the debug logs more useful by remove unnecessary entries from our monitoring Filebeat
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration files./changelog/fragments
using the changelog tool## Disruptive User ImpactHow to test this PR locally
Create a log file with more than 1kb:
docker run -it --rm mingrammer/flog -n 20 > /tmp/flog.log
Package the Elastic-Agent from this PR
Start the Elastic-Agent with the following configuration
elastic-agent.yml
Ensure the event logs (
data/elastic-agent*/logs/events/*.ndjson
) do not contain any messages from thecopy_fields
processor. The following command must return0
:Related issues
copy_fields
processor error #5299Questions to ask yourself