-
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
[ResponseOps] Some rules are getting skipped when performing bulkEnableRules
and bulkDisableRules
#181050
Comments
Pinging @elastic/response-ops (Team:ResponseOps) |
@xcrzx Thanks a lot for opening this ticket! I would imagine that this bug affects our bulk actions endpoint through which detection rules are being enabled/disabled.
|
bulkEnableRules
and bulkDisableRules
We have implemented a workaround in our code where we loop through the original rule array instead of relying on the response from RulesClient. Yes, it would be best to update this code as well when the issue is resolved. Lines 69 to 85 in acdeb8d
|
Created #192207 for discrepancy between the rule state and task manager |
Related to: #177634
Summary
When performing bulk enable or disable operations, some rules are getting skipped. For the bulk enable operation, it skips all rules that are already enabled, and for bulk disable, it skips those that are already disabled. This behavior creates several issues when using the rules client.
1. Inconsistent responses from RulesCLient
If you call
rulesClient.bulkEnableRules({ ids: ['ruleId1', 'ruleId2'] })
with the same arguments but affected rules in different enabled/disabled states, you can get three different responses, making this call non-idempotent. Here are some examples:Both rules initially disabled:
One rule disabled, one enabled:
Both rules initially enabled:
Expected responses
I expect the rules passed as params to end up either in the
errors
array or therules
array in the returned object regardless of their initial state.2. Discrepancy between the rule state and task manager
When enabling rules, the Alerting framework skips rules if their saved object has
alert.attributes.enabled: true
. This behavior creates issues described here and in the attached SDH. There might be a situation where a rule is marked as enabled, but no corresponding task exists in the Task Manager. In the UI, these rules will appear enabled but will never run. Users expect that all rules affected by the bulk enable action will get a corresponding task created in the Task Manager and be scheduled for execution. Therefore, it would be best to also check if the rules to be enabled have tasks in the Task Manager, instead of relying solely on the rule's current enabled state.The text was updated successfully, but these errors were encountered: