Skip to content
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

[Security Solution][Alerts] Use dynamic mappings to create smaller templates & mappings #100884

Open
Tracked by #165878
tsg opened this issue May 28, 2021 · 9 comments
Open
Tracked by #165878
Labels
discuss Team:Detection Engine Security Solution Detection Engine Area Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:SIEM Theme: rac label obsolete

Comments

@tsg
Copy link
Contributor

tsg commented May 28, 2021

The Fleet and Elasticsearch teams have optimized the data ingestion mappings to use dynamic mappings as much as possible: elastic/elasticsearch#64978 Here is the current version of the template: https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/resources/data-streams-mappings.json

We should consider doing the same for alerts as data.

The idea is to take advantage of the following observations:

  • most ECS fields are keywords, so if we default to the keyword type, the template size can be dramatically reduced
  • ECS has conventions for IP fields (*.ip) and text fields (*.message)
  • the rest of the fields can show up explicitly in the mapping.

In addition to the benefit of having smaller templates, this means that all the fields that don't show up explicitly (keywords) are zero-cost when they are not used. This reduces the cost of assuming the whole of ECS is the base of the Alert schema.

We need to be careful, though, to not cause mapping conflicts, because we're copying data from disparate indices that can be in conflict with one another. I think the following approach would be feasible:

  • The Alert mappings use dynamic fields for keywords and other special cases
  • The alert.original_event field is set to be not indexed at all or flattened
  • The Kibana code that creates the Alert documents puts all the ECS + well known alerting fields at the top level, and any other field under alert.original_event.
  • When copying the ECS + well-known fields, the code must verify that the fields have the correct types (string vs object vs number) and ignore the fields that don't match. This ensures that the resulting mapping is consistent with ECS.
  • Every other field goes under alert.original_event where it can't cause conflicts.
@botelastic botelastic bot added the needs-team Issues missing a team label label May 28, 2021
@tsg tsg added the Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! label May 28, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@botelastic botelastic bot removed the needs-team Issues missing a team label label May 28, 2021
@tsg tsg added Theme: rac label obsolete discuss labels May 28, 2021
@jportner
Copy link
Contributor

@tsg did you mean to use the Team:SIEM label for this?

@tsg tsg added Team:SIEM and removed Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels May 28, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@tsg
Copy link
Contributor Author

tsg commented May 28, 2021

Argh, yes, sorry.

@tsg
Copy link
Contributor Author

tsg commented Jun 1, 2021

FYI on another evolution on the Integration side: elastic/package-spec#178 The approach above doesn't have the same problem for us, because the top-level fields are always well-known.

@banderror banderror added Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detections and Resp Security Detection Response Team labels Sep 8, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@banderror banderror added the Team:Detection Alerts Security Detection Alerts Area Team label Oct 11, 2021
@banderror
Copy link
Contributor

Hey everyone, FYI ownership of this ticket and other tickets related to rule_registry (like #101016) now goes to the Detection Alerts area (Team:Detection Alerts label). Please ping @peluja1012 and @marshallmain if you have any questions.

@marshallmain marshallmain changed the title [RAC] Use dynamic mappings to create smaller templates & mappings [Security Solution][Alerts] Use dynamic mappings to create smaller templates & mappings Apr 19, 2022
@marshallmain
Copy link
Contributor

This issue primarily affects security solution alerts indices since those indices are currently the only rule registry-based indices that use the full ECS mappings.

@yctercero yctercero added Team:Detection Engine Security Solution Detection Engine Area and removed Team:Detection Alerts Security Detection Alerts Area Team labels May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Team:Detection Engine Security Solution Detection Engine Area Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:SIEM Theme: rac label obsolete
Projects
None yet
Development

No branches or pull requests

6 participants