-
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
[Security Solution][Alerts] Format alerts for per-alert action context variables #155812
Comments
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Alert prior to
Alert after
|
A faster implementation of Implementation:
I also added one extra test in
cc @e40pud |
…t variables (#155829) ## Summary Closes [#155812](#155812) In #155384, detection rules were switched to support per-alert actions. When passing the context variable, it was suggested that we should be calling formatAlert to format the alert for notifications, however doing that causes some test failures because formatAlert is fairly heavyweight and bunch of tests were timing out. Thanks to @marshallmain we have this much faster `expandDottedObject` that solves the issue with the very slow `formatAlert`.
…t variables (elastic#155829) ## Summary Closes [elastic#155812](elastic#155812) In elastic#155384, detection rules were switched to support per-alert actions. When passing the context variable, it was suggested that we should be calling formatAlert to format the alert for notifications, however doing that causes some test failures because formatAlert is fairly heavyweight and bunch of tests were timing out. Thanks to @marshallmain we have this much faster `expandDottedObject` that solves the issue with the very slow `formatAlert`. (cherry picked from commit 8f59720)
…context variables (#155829) (#156009) # Backport This will backport the following commits from `main` to `8.8`: - [[Security Solution][Alerts] Format alerts for per-alert action context variables (#155829)](#155829) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Ievgen Sorokopud","email":"ievgen.sorokopud@elastic.co"},"sourceCommit":{"committedDate":"2023-04-26T16:16:41Z","message":"[Security Solution][Alerts] Format alerts for per-alert action context variables (#155829)\n\n## Summary\r\n\r\nCloses [#155812](https://github.com/elastic/kibana/issues/155812)\r\n\r\nIn #155384, detection rules were\r\nswitched to support per-alert actions. When passing the context\r\nvariable, it was suggested that we should be calling formatAlert to\r\nformat the alert for notifications, however doing that causes some test\r\nfailures because formatAlert is fairly heavyweight and bunch of tests\r\nwere timing out.\r\n\r\nThanks to @marshallmain we have this much faster `expandDottedObject`\r\nthat solves the issue with the very slow `formatAlert`.","sha":"8f597207a222f02b1c7664bc555a9f6e744bc4aa","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v8.8.0"],"number":155829,"url":"https://github.com/elastic/kibana/pull/155829","mergeCommit":{"message":"[Security Solution][Alerts] Format alerts for per-alert action context variables (#155829)\n\n## Summary\r\n\r\nCloses [#155812](https://github.com/elastic/kibana/issues/155812)\r\n\r\nIn #155384, detection rules were\r\nswitched to support per-alert actions. When passing the context\r\nvariable, it was suggested that we should be calling formatAlert to\r\nformat the alert for notifications, however doing that causes some test\r\nfailures because formatAlert is fairly heavyweight and bunch of tests\r\nwere timing out.\r\n\r\nThanks to @marshallmain we have this much faster `expandDottedObject`\r\nthat solves the issue with the very slow `formatAlert`.","sha":"8f597207a222f02b1c7664bc555a9f6e744bc4aa"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155829","number":155829,"mergeCommit":{"message":"[Security Solution][Alerts] Format alerts for per-alert action context variables (#155829)\n\n## Summary\r\n\r\nCloses [#155812](https://github.com/elastic/kibana/issues/155812)\r\n\r\nIn #155384, detection rules were\r\nswitched to support per-alert actions. When passing the context\r\nvariable, it was suggested that we should be calling formatAlert to\r\nformat the alert for notifications, however doing that causes some test\r\nfailures because formatAlert is fairly heavyweight and bunch of tests\r\nwere timing out.\r\n\r\nThanks to @marshallmain we have this much faster `expandDottedObject`\r\nthat solves the issue with the very slow `formatAlert`.","sha":"8f597207a222f02b1c7664bc555a9f6e744bc4aa"}}]}] BACKPORT--> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
We believe that this update has caused an issue with our alerting once we upgraded to 8.8.0. We heavily rely on the fields in the alerts as we pass them along to webhooks for notification. It seems that at least two fields were no longer available which contained the alert name and tags. Our alerts immediately were missing this data after upgrading from 8.7.1 to 8.8.0. We were able to correct by replacing the fields we had with the proper ones. Example: {{alertName}} changed to {{context.rule.name}} With all of that being said and the above is true, two things:
|
Furthermore, it appears the current docs have screenshots of a field reference that we firmly believe won't work as mentioned above: |
In this PR, detection rules were switched to support per-alert actions. When passing the context variable, it was suggested that we should be calling
formatAlert
to format the alert for notifications, however doing that causes some test failures becauseformatAlert
is fairly heavyweight and the following tests were timing out:We should (1) determine if
formatAlert
is strictly necessary for these context variables, (2) determine if we can move this call to the alerting framework, and (3) if not, can we increase the test timeout for the failing tests?The text was updated successfully, but these errors were encountered: