Drop not audit logs in elasticsearch/audit fileset ingest pipeline#30164
Drop not audit logs in elasticsearch/audit fileset ingest pipeline#30164tetianakravchenko merged 5 commits intoelastic:mainfrom
Conversation
|
This pull request does not have a backport label. Could you fix it @tetianakravchenko? 🙏
NOTE: |
|
Pinging @elastic/integrations (Team:Integrations) |
There was a problem hiding this comment.
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 |
filebeat/module/elasticsearch/audit/test/test-audit-docker.log-expected.json
Outdated
Show resolved
Hide resolved
|
/test |
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
e42c474 to
264c8d1
Compare
…/audit Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
|
/test |
…30164) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix formatting Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix typos Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 1e72124)
…30164) (#30239) * adjust elasticsearch/audit fileset Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix formatting Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix typos Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
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 <tetiana.kravchenko@elastic.co> * fix formatting Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix typos Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (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 <tetiana.kravchenko@elastic.co> * fix formatting Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * adjust drop condition; revert test case for docker Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix typos Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * remove 'remove' of user.name field in pipeline-json for elasticsearch/audit Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 1e72124) Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (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 <mat@elastic.co>
Signed-off-by: Tetiana Kravchenko tetiana.kravchenko@elastic.co
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.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
Related issues
Use cases
Screenshots
Before adjustments:

After:
Logs