-
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
Drop not audit logs in elasticsearch/audit fileset ingest pipeline #30164
Conversation
This pull request does not have a backport label. Could you fix it @tetianakravchenko? 🙏
NOTE: |
Pinging @elastic/integrations (Team:Integrations) |
field: event.type | ||
path: elasticsearch.audit | ||
- drop: | ||
if: '!["rest", "transport", "ip_filter", "security_config_change"].contains(ctx.elasticsearch?.audit?.event?.type)' |
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.
it would be much easier to use ctx.elasticsearch.audit.type != 'audit'
, but as I see this field was introduced only in version 7.3 - elastic/elasticsearch#42887 (docker - https://github.com/elastic/elasticsearch/blob/7.3/distribution/docker/docker-build-context/src/docker/config/log4j2.properties and in core - https://github.com/elastic/elasticsearch/blob/7.3/x-pack/plugin/core/src/main/config/log4j2.properties#L6), in version 7.1 it was not yet available https://github.com/elastic/elasticsearch/blob/7.1/x-pack/plugin/core/src/main/config/log4j2.properties
would it maybe be file to drop support for < 7.3 ?
from the doc it looks like event.type should be a good filter for audit logs, or am I missing smth?
Pinging @elastic/stack-monitoring (Stack monitoring) |
Makes some sense to me. Thinking it might be good to have @pgomulka review this, especially since he recently helped pull log samples for ES 8.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.
I left few questions
filebeat/module/elasticsearch/audit/test/test-audit-docker.log-expected.json
Show resolved
Hide resolved
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.
LGTM
/test |
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
e42c474
to
264c8d1
Compare
Signed-off-by: Tetiana Kravchenko <[email protected]>
…/audit Signed-off-by: Tetiana Kravchenko <[email protected]>
/test |
…30164) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <[email protected]> * fix formatting Signed-off-by: Tetiana Kravchenko <[email protected]> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <[email protected]> * fix typos Signed-off-by: Tetiana Kravchenko <[email protected]> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 1e72124)
…30164) (#30239) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <[email protected]> * fix formatting Signed-off-by: Tetiana Kravchenko <[email protected]> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <[email protected]> * fix typos Signed-off-by: Tetiana Kravchenko <[email protected]> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <[email protected]>
test-audit-docker.log also contains a case but it was overlooked in the expected file until elastic#30164 added the appropriate drop statements.
…30164) (#30239) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <[email protected]> * fix formatting Signed-off-by: Tetiana Kravchenko <[email protected]> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <[email protected]> * fix typos Signed-off-by: Tetiana Kravchenko <[email protected]> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 32ecd20)
…h logs (#30440) * Ensure we drop server logs that show up in deprecation pipeline * Add note about deprecation dataset normalization * Add test for mixed es server logs This pipeline already contained a drop to avoid duplicate logging. * Ensure we drop server logs that show up in slowlog pipeline This was partially guarded against in testing due to the grok on `elasticsearch.slowlog` but probably better to explicitly drop and avoid duplicate logging. * Add "mixed" test for elasticsearch audit logs test-audit-docker.log also contains a case but it was overlooked in the expected file until #30164 added the appropriate drop statements. * Changelog entry * Remove duplicatd filebeat header
…h logs (#30440) * Ensure we drop server logs that show up in deprecation pipeline * Add note about deprecation dataset normalization * Add test for mixed es server logs This pipeline already contained a drop to avoid duplicate logging. * Ensure we drop server logs that show up in slowlog pipeline This was partially guarded against in testing due to the grok on `elasticsearch.slowlog` but probably better to explicitly drop and avoid duplicate logging. * Add "mixed" test for elasticsearch audit logs test-audit-docker.log also contains a case but it was overlooked in the expected file until #30164 added the appropriate drop statements. * Changelog entry * Remove duplicatd filebeat header (cherry picked from commit 7b67384)
…h logs (#30440) * Ensure we drop server logs that show up in deprecation pipeline * Add note about deprecation dataset normalization * Add test for mixed es server logs This pipeline already contained a drop to avoid duplicate logging. * Ensure we drop server logs that show up in slowlog pipeline This was partially guarded against in testing due to the grok on `elasticsearch.slowlog` but probably better to explicitly drop and avoid duplicate logging. * Add "mixed" test for elasticsearch audit logs test-audit-docker.log also contains a case but it was overlooked in the expected file until #30164 added the appropriate drop statements. * Changelog entry * Remove duplicatd filebeat header (cherry picked from commit 7b67384)
…30164) (#30239) (#30447) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <[email protected]> * fix formatting Signed-off-by: Tetiana Kravchenko <[email protected]> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <[email protected]> * fix typos Signed-off-by: Tetiana Kravchenko <[email protected]> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <[email protected]> (cherry picked from commit 32ecd20) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…h logs (#30440) (#30488) * Ensure we drop server logs that show up in deprecation pipeline * Add note about deprecation dataset normalization * Add test for mixed es server logs This pipeline already contained a drop to avoid duplicate logging. * Ensure we drop server logs that show up in slowlog pipeline This was partially guarded against in testing due to the grok on `elasticsearch.slowlog` but probably better to explicitly drop and avoid duplicate logging. * Add "mixed" test for elasticsearch audit logs test-audit-docker.log also contains a case but it was overlooked in the expected file until #30164 added the appropriate drop statements. * Changelog entry * Remove duplicatd filebeat header (cherry picked from commit 7b67384) Co-authored-by: Mat Schaffer <[email protected]>
Signed-off-by: Tetiana Kravchenko [email protected]
What does this PR do?
drop log message in elasticsearch/audit ingest pipeline if it is not an audit log.
in ingest pipelines there are defined drop as a first step - for server, slowlog, and deprecation
there is no drop defined for audit logs - https://github.com/elastic/beats/blob/master/filebeat/module/elasticsearch/audit/ingest/pipeline-json.yml
as a result there might be logs duplications - as described in #16540
note: it is not related to the kubernetes itself, in case audit and other log will be written to the same file - there will be the same problem.
Why is it important?
Avoid logs duplication in different filesets.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Related issues
Use cases
Screenshots
Before adjustments:
After:
Logs