-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[ES output] Correctly log event fields in events log file #40512
[ES output] Correctly log event fields in events log file #40512
Conversation
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
befcdd4
to
3992b2c
Compare
This pull request is now in conflicts. Could you fix it? 🙏
|
The Elasticsearch output, when faced with ingestion errors was logging the raw publisher.Event that had already been encoded, hence no event fields were present in the logs. This commit fixes it by adding a String method to the encodedEvent type and using the encodedEvent in the logs instead of the publisher.Event.
4f44670
to
ff5c4f8
Compare
Do we know why the existing event log tests failed to catch this, since they were intended to? |
As you'd suggested, the tests were looking for a substring that is also present in the ES response, it was just the value of the field. Now the new tests look for a piece of the JSON encoding of the fields, which at the time of testing was not part of the ES response, it has to come from the event being logged. |
The Elasticsearch output, when faced with ingestion errors was logging the raw publisher.Event that had already been encoded, hence no event fields were present in the logs. This commit fixes it by adding a String method to the encodedEvent type and using the encodedEvent in the logs instead of the publisher.Event. (cherry picked from commit e7732c6) # Conflicts: # libbeat/outputs/elasticsearch/client.go
…nts log file (#40531) * [ES output] Log event fields in events log file (#40512) The Elasticsearch output, when faced with ingestion errors was logging the raw publisher.Event that had already been encoded, hence no event fields were present in the logs. This commit fixes it by adding a String method to the encodedEvent type and using the encodedEvent in the logs instead of the publisher.Event. (cherry picked from commit e7732c6) # Conflicts: # libbeat/outputs/elasticsearch/client.go * Fix merge conflicts --------- Co-authored-by: Tiago Queiroz <[email protected]>
Proposed commit message
The Elasticsearch output, when faced with ingestion errors was logging the raw publisher.Event that had already been encoded, hence no event fields were present in the logs.
This commit fixes it by adding a String method to the encodedEvent type and using the encodedEvent in the logs instead of the publisher.Event.
Closes: #40509
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
None, it fixes a bug.
## Author's ChecklistHow to test this PR locally
Start Filebeat with the following configuration
Create the log file
/tmp/flog.log
with the following content:Look for the event log file:
logs/filebeat-events-data*.ndjson
and ensure the logged events contains their fields.Here is an example of how the content of the event log file should look like:
## Use cases## Screenshots