-
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
Log raw events and errors containing events to a separate file #37475
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
CI is failing because elastic/elastic-agent-libs#169 has not been merged yet. |
db6216e
to
3185361
Compare
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
7efeff1
to
b39a910
Compare
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
💚 Build Succeeded
Expand to view the summary
Build stats
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
This pull request is now in conflicts. Could you fix it? 🙏
|
b39a910
to
0a2e9a2
Compare
💚 Build Succeeded
Expand to view the summary
Build stats
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
💔 Build Failed
Expand to view the summary
Build stats
Pipeline error
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
dcde0e5
to
8cbb4b4
Compare
💔 Build Failed
Expand to view the summary
Build stats
Pipeline error
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
go.mod
Outdated
@@ -419,3 +419,5 @@ replace ( | |||
|
|||
// Exclude this version because the version has an invalid checksum. | |||
exclude github.com/docker/distribution v2.8.0+incompatible | |||
|
|||
replace github.com/elastic/elastic-agent-libs => github.com/belimawr/elastic-agent-libs v0.2.9-0.20240116105334-25f61a14ad41 |
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'll update this once elastic/elastic-agent-libs#171 is merged.
Update documentation and notice file
This commit fixes the lint issues and adds small improvements.
There was some dependency conflict with Python protobuf 3.19.4 and 3.19.5 when running `make update`. To solve the conflict I updated all usages to 3.19.5.
24118b3
to
3fc66fc
Compare
Rebased onto |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
This pull request is now in conflicts. Could you fix it? 🙏
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Setting back to draft for now. |
Closing as the behaviour has changed and it was easier to start from a new branch. The new PR with the same feature: #38767 |
Proposed commit message
This commit introduces a new logger that can be configured through
logging.sensitive
that can be used to log any message that contains the whole event or could contain any sensitive dataAt the moment it is used by multiple outputs to log indexing errors containing the whole event and errors returned by Elasticsearch that can potentially contain the whole event.
Open questions
Expected behaviour in a container environment?
When Beats is running in a Container environment we set the log output to stdout (see the example in our documentation, however the "sensitive logger" will always log to a file in the default log file.
Decision:
In all cases add a new field
log.type: sensitive
for the sensitive logger and allow it to also log to stderr as well as disabling the logger.The docker command, note the
-e
CLI flag:When running the command above, the events log file is created inside the container in
/usr/share/filebeat/logs/
To have the sensitive logger logging to stderr, add the following CLI flag to Filebeat:
-E logging.sensitive.to_stderr=true -E logging.sensitive.to_files=false
Generated log file example:
Expected behaviour when running under Elastic-Agent?
The same applies when running under Elastic-Agent: the Elastic-Agent runs Beats passing the the CLI flag
-E logging.sensitive.to_stderr=true -E logging.sensitive.to_files=false
, collects the stderr and stdout from the Beat, wraps every line in a JSON containing some metadata and logs it to the correct log file. The concept of a sensitive log file will be added to the Elastic-Agent.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
Test if the Elastic-Agent diagnostics can collect the new log file(s)How to test this PR locally
Standalone Filebeat
Start Filebeat with the following configuration
Create the log file
/tmp/flog.log
with the following content:Raw events should be logged to a different log file, in the same folder as the normal logs, the filename matches the glob
filebeat-events-data*.ndjson
.By default the logs go in a
logs
folder that's created in the same folder you're running Filebeat from, here are the files created when running this branch:If you need to run the test again, either add more data to
/tmp/flog.log
or remove thedata
folder Filebeat created at star up, this will make Filebeat re-ingest the file.Under Elastic-Agent
/tmp/flog.log
with a few lines, the data is not importantTo create ingest failures the easiest way is to close the write index from the datastream, to do that go to Kibana -> Dev Tools
To get the backing index for a datastream:
This will return something like:
Take note of the index_name
.ds-logs-generic-default-2024.01.22-000001
.Close this index:
/tmp/flog.log
You should see in the logs something like this:
## Related issues## Use cases## Screenshots## Logs