-
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
[Filebeat] Add module for Kibana audit logs #22696
Conversation
929a926
to
32fe416
Compare
c5837d9
to
ab260bd
Compare
ab260bd
to
d3cafc4
Compare
Pinging @elastic/integrations-services (Team:Services) |
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.
Not a full review, but these are the ones that popped out to me at first.
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.
Looks great!
Verified that ECS audit logs are imported correctly.
Couple comments but I don't know enough about processors so might not be applicable.
- add_fields: | ||
target: '' | ||
fields: | ||
ecs.version: 1.6.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.
Is this something we should log from Kibana instead?
If we want to update to a later version of ECS that should be controlled by Kibana, not the Filebeat module.
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.
Good question; I think this would make sense for Kibana to log instead of Filebeat. I copied this over from the ES config, but it probably doesn't make sense for us to follow suit here.
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.
Cool, I'll create a PR to log that in Kibana: elastic/kibana#85390
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 came across this when testing. It appears that Filebeat is expecting that it'll set an explicit version itself:
beats/filebeat/tests/system/test_modules.py
Line 104 in 4dd8061
self.assert_explicit_ecs_version_set(module, fileset) |
I worked around this, but I don't know if that's "ok" or not 😕
- rename: | ||
if: ctx.kibana._audit_temp.kibana.delete_from_spaces != null | ||
target_field: kibana.delete_from_spaces | ||
field: kibana._audit_temp.kibana.delete_from_spaces |
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'm a bit worried about picking fields within kibana
manually since it's supposed to be possible for plugin developer to add whatever fields they need and I would expect that to be ingested using the Filebeat module.
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'm a bit worried about picking fields within kibana manually since it's supposed to be free for login developer to add whatever fields they need and I would expect that to be ingested using the Filebeat module.
I'm torn on this too. On one hand, it would be great if this module "just worked" whenever a new field was added. On the other hand, unknown fields will be dynamically mapped, which might not be what we want. @P1llus are there recommendations on how filesets should handle dynamic fields? Should we accept them so they are mapped dynamically, or should we attempt to keep the mapping in sync with changes in Kibana going forward?
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.
The general way we approach it, is ensuring that all fields coming from filebeat modules would be appended under modulename.filesetname.*
.
I usually copy the whole event under the correct field root first (in this case kibana.audit
), then rename the ones that are moved to ECS while keeping the rest under kibana.audit
In terms of dynamic mapping, I would recommend to map as many fields as possible, however if you know that there is certain fields with complex or everchanging field names, you can apply the "flattened
" type to the top field for that usecase, though please don't set the root field kibana.audit
as flattened, you could also have a specific field if you want, in which you put all custom data.
Hope that makes sense @legrego @thomheymann
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 am not a fan of changing the JSON structure from what's logged since it is already in the format that we want and it would be super confusing for users otherwise.
I'm starting to think that it then might be better to restrict the ECS schema in Kibana so that only known fields are allowed to be logged which we can map manually in the Filebeat pipeline.
Is there a way of defining this pipeline using an npm module in the Kibana repository or can we publish a Go module from within Kibana? I'm a bit worried about these things being dislocated and going out of sync. (Developers adding fields without updating Filebeat pipeline)
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'm starting to think that it then might be better to restrict the ECS schema in Kibana so that only known fields are allowed to be logged which we can map manually in the Filebeat pipeline.
++ I think this is the safest approach for now too, until we get to the point where we actually require dynamic fields that can't be known ahead of time.
Is there a way of defining this pipeline using an npm module in the Kibana repository or can we publish a Go module from within Kibana? I'm a bit worried about these things being dislocated and going out of sync. (Developers adding fields without updating Filebeat pipeline)
I wonder if there's something we could do within Kibana to enforce this. If we had the audit logger run alongside the functional test suites, we could inspect it to ensure that it's not capturing anything unexpected.
If it wouldn't be so expensive to do, we could do a runtime enforcement, but I don't think that's worth the overhead at this point.
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've typed the kibana
namespace in elastic/kibana#85451
@P1llus am I not allowed to use the beats/filebeat/tests/system/test_modules.py Lines 175 to 176 in 4dd8061
|
…pdated log format
…ibana-audit-module
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 - Thanks for taking this on!
Co-authored-by: Thom Heymann <190132+thomheymann@users.noreply.github.com>
👶 First beats PR
This is my first time submitting a PR against this repository, so I'm sorry if I've missed something obvious.
What does this PR do?
Adds support to Filebeat for ingesting Kibana's ECS Audit Log, available in 7.11+.
Specifically, this adds a new
audit
fileset to the existingkibana
module, defining a new pipeline, additional fields, and tests.Why is it important?
Having first-class support for ingesting stack audit logs is critical to improving observability.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Setup and run Kibana with ECS Audit Logging enabled (instructions).
Configure filebeat's
kibana
module to read the audit log: