[M365 Defender] Improve ECS mapping and fix incorrect or missing fields - #7522
Conversation
🌐 Coverage report
|
… making the pipeline much easier to navigate and review
efd6
left a comment
There was a problem hiding this comment.
I haven't taken a look at the dashboards.
| copy_from: m365_defender.event.account.sid | ||
| ignore_empty_value: true | ||
| tag: set_user_id | ||
| if: ctx.m365_defender?.event?.category?.toLowerCase().contains('identitylogonevents') |
There was a problem hiding this comment.
This is unsafe; in the case of a null at any stage in the accessor path, we end up calling a method on null. So we need to have a separate null check and short circuit.
There was a problem hiding this comment.
While this field can never be null, we can at least check if ctx.m365_defender.event.category is null first, if there comes a time that event is null, then the document is empty, and something more serious has happened.
Will add a commit to add nullchecks for category
There was a problem hiding this comment.
ctx.m365_defender?.event?.category is a required field in default.yml to run the other pipelines, and can never be empty.
The field is also set by Event Hub, so if this field is missing, no parsing would be done either way. Looking at the massive amount of null-checks needed for ctx.m365_defender?.event?.category, do we really want to keep them?
There was a problem hiding this comment.
Can we have a drop processor at the top with a comment explaining this for the case when ctx.m365_defender?.event?.category == null. That would obviate all the checks.
There was a problem hiding this comment.
I think a drop is a bit much, but I can add an error.message maybe, saying that the field is missing, just in case.
There was a problem hiding this comment.
For the invariant to be usable it must be a drop. If it can't be a drop, then we don't have the invariant and all the null checks must be in place.
|
Added screenshots, dashboards and fixes from PR comments |
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
…ds (elastic#7522) * draft commit * adding testdata * fixing category if condition logic to use contains * Moves all the processors around and groups them by logic and usecase, making the pipeline much easier to navigate and review * Add rename processors for previously removed convert processors that was unecessary * group processors in alert pipeline together, similar to device pipeline * group app_and_identify processors together to fit the format of the others * updating ecs.yml and fields.yml definitions * Update conditions for number to boolean conditions to prevent casting errors * stash dashboard changes * adding all dashboards and new screenshots * added fixes to pipelines from PR comments * added major version bump * adding PR comments and updating generated test files
What does this PR do?
This rewamps the Event datastream, and does some bigger format changes, which reflects in the git diff.
When reviewing this, since many existing processors and definitions have simply moved to another location, its better to review these ingest pipelines as if they were new, rather than looking at what changed.
This is a list of changed applied:
General Changes:
Alert Pipeline Changes:
Device Pipeline Changes:
App/Email/Identity Pipeline Changes:
Checklist
changelog.ymlfile.Screenshots
Event datastream dashboards was rewritten, while Incidents (Incidents and Alerts) simply had their table of contents added.






Event datastream:
Incidents datastream:



