-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SIEM][Detection Engine] Adds a tags service and optimizes alert_id lookups #52838
[SIEM][Detection Engine] Adds a tags service and optimizes alert_id lookups #52838
Conversation
Pinging @elastic/siem (Team:SIEM) |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
if (ruleId == null) { | ||
return tags; | ||
} else { | ||
return [...tags, `${INTERNAL_RULE_ID_KEY}:${ruleId}`]; |
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.
It might be (slightly) more performant here to utilize concat
to append the internal rule id tag.
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.
Per conversations we will keep using the ES2015+ style unless we are dealing with larger arrays.
Thanks for pointing out though that technically the concat is faster as I typically like that style more but the ES2015 is what we encourage on the team for small stuff.
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.
Left an optional comment but reviewed and tested locally and everything looks awesome!
Summary
alert_id
look up that was a full alert scan and instead uses an internal structure that it augments to the tags for fastalert_id
look ups.Usage for the UI:
or shell script:
Returns:
Testing:
Ensure that the internal structure does not leak when doing any of these script/API calls
Caveat:
You can do filter searches against tags that have the double underscore such as:
./find_rule_by_filter.sh "alert.attributes.tags:%20__*"
But that shouldn't be a big problem and more than likely no one will be naming something with double underscores.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately