Suggestion: Elastic Common Schema support for match_body in elastalert-create-index #1040
Replies: 1 comment
-
Hello! My experience with ECS is that it works reasonably well as long as all ingested data complies. I've seen some fields that happen to share similar names with ECS but actually contain unrelated data and conflicting types. Ex: I like the idea, and if it makes ElastAlert 2 more usable, more powerful, then I'm onboard. That said, I'd like to see the ECS fields disabled (not created during index creation) by default. So a runtime or config parameter would be necessary to enable that functionality. I think this is best since the majority of users do not attempt to use ElastAlert 2 index data in their rule filters, and so this will eliminate any risk of incidental field conflicts, potentially causing ElastAlert 2 to malfunction and cause people to miss important alerts. Meanwhile, for those power users that know there will never be conflicting field data types, they can enable it (and rebuild their indices if retrofitting an existing install.) Thanks for offering to implement this functionality. If you end up proceeding, please follow the project's contribution guidelines. |
Beta Was this translation helpful? Give feedback.
-
Hi. Our analyst is trying to write an Elastalert rule that would query rule matches, creating secondary matches based on rule names and some
match_body
fields, and I believe we're not the first ones to try that. He ended up hitting a dead end due to thematch_body
field being disabled in EA writeback index - my understanding is that this was done because it may contain data from different indices with incompatible mappings.This seems to be a perfect use case for Elastic Common Schema, which has a predefined list of field names, with mappings supplied by Elastic, so I suggest adding a key for elastalert-create-index to include ECS mappings of the appropriate version in the writeback index.
I ended up with the following query to add mappings for ECS-compliant fields, while disabling all others:
In this template,
disable_non_ecs_match_body_objects
disables the object-type non-ECS subfields, anddisable_non_ecs_match_body_fallback
(with the same regex) disables indexing for all non-object non-ECS subfields and also maps them tokeyword
to prevent mapping type collisions (they still happen even if the field indexing is disabled).Caveats that I'm aware of:
If this seems like a worthwhile addition, I can try to implement it.
Beta Was this translation helpful? Give feedback.
All reactions