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

[Request] [Detection Engine] add EQL alert suppression docs for non-sequence queries #4977

Closed
WafaaNasr opened this issue Mar 22, 2024 · 5 comments
Assignees
Labels
Effort: Medium Issues that take moderate but not substantial time to complete Feature: Rules Priority: High Issues that are time-sensitive and/or are of high customer importance Team: Detection Engine ui-copy v8.14.0

Comments

@WafaaNasr
Copy link

WafaaNasr commented Mar 22, 2024

Description

Implementing alert suppression for EQL non-sequence-based alerts while disabling it for sequence alerts involves two main scenarios:

Scenario 1:
When a user inputs a sequence query, suppression fields are automatically disabled. A tooltip appears when hovering over any suppression field, indicating "Suppression is not enabled for EQL sequence queries."

Scenario 2:
If suppression fields are configured prior, and the user edits an EQL rule that wasn't originally a sequence query but is changed to one, a validation error occurs below the suppression group by fields. The error message states: "Suppression is not enabled for EQL sequence queries. Please reset the suppression fields." Once the user removes the suppression fields, they are disabled, following the behavior outlined in Scenario 1.

Explaining the second Scenario:
https://github.com/elastic/security-docs/assets/12671903/9eafe84e-c8dd-4c39-9c90-5c76ea2b8e9a

Details

  • When users create an Eql rule, they can specify the fields they want to be grouped for suppression. For EQL rules, the minimum number of field names that can be specified is 1. The max is 3.

  • The maximum number of alerts that can be suppressed is tied to the max_signals setting.

  • If enabling suppression causes the EQL rule to timeout during the rule preview or when the rule is enabled and running, there are two possible ways to resolve this:

    • Turn off suppression on the rule.
    • Shorten the rule's look-back time to reduce the number of documents the rule analyzes.
  • Fields with an array of values are treated as a single group and suppressed together (i.e., they're treated as a single suppression value). When you check the kibana.alert.suppression.terms field, you'll see an array of values for suppressed fields.

    1. Imagine we have the below document:
    {
              id,
              '@timestamp': timestamp,
              host: { name: ['host-a', 'host-b'] },
            };
    
    1. We indexed this document 3 times with different timestamps
    2. We have the below threat index
    {
                host: {
                      name: 'host-a',
                  },
     };
    
    1. We enabled suppression for the IM rule
    2. we will end up having 1 alert generated only and the suppression count will be 2 and the suppression.terms will be an array, not a single value as in the Query rule case
     kibana.alert.suppression.terms: [
                {
                  field: 'host.name',
                  value: ['host-a', 'host-b'],
                },
              ],
    
  • The new alert_supression param for eql rules has the same functionality as the query rule.

  • The default maximum number of alerts that can be suppressed for each rule type:

    • Custom query rule: indefinite number of alerts
    • Threshold: The max_signals value (100 by default)
    • Indicator match rule: Five times the max_signals value (500 by default)
    • Eql non-sequence rule: The max_signals value (100 by default)

Background & resources

Which documentation set does this change impact?

ESS and serverless

ESS release

8.14

Serverless release

Around 8.14 release

Feature differences

ESS: Alert suppression is available for Platinum license
Serverless: available for Essentials and Complete tiers

API docs impact

Adds alert_suppression field to Eql rule create/update/patch rule APIs

Prerequisites, privileges, feature flags

ESS: requires Platinum license
Feature Flag: alertSuppressionForNonSequenceEqlRuleEnabled

@nastasha-solomon
Copy link
Contributor

@rylnd if you still need it, here are some options for the scenarios listed above.

Scenario 1

Tooltip that lets users know that alert suppression isn't supported for sequence queries:

  • Original text: Suppression is not enabled for EQL sequence queries.
  • Option 1: Suppression is not supported for EQL sequence queries.
  • Option 2: Suppression isn't available for EQL sequence queries.
  • Option 3: Suppression can't be configured for EQL sequence queries.

Scenario 2

Validation message that displays when users change a non-sequence query to a sequence query:

  • Original text: Suppression is not enabled for EQL sequence queries. Please reset the suppression fields.
  • Option 1: Suppression isn't supported for EQL sequence queries. Change the EQL query to a non-sequence query, or remove the suppression fields.
  • Option 2: Suppression isn't supported for EQL sequence queries. You must remove all suppression fields before you can save this rule.
  • Option 3: Suppression isn't supported for EQL sequence queries. To fix this error, remove the suppression fields.

Let me know if you have questions, concerns, or suggestions for any of these.

@nastasha-solomon
Copy link
Contributor

nastasha-solomon commented Apr 4, 2024

Action items from meeting with @rylnd today:

  • Follow-up on how fields with multiple values are suppressed. Are they suppressed like custom query and threshold alerts (alert grouping is created for each value), or are they handled like IM alerts (fields that contain an array of values are grouped and suppressed)? Or, are they handled in a completely different way?
  • Figure out the target Serverless release date. This will determine when docs need to be done and when I should publish them to the Serverless docset.
  • Determine whether this feature will be, or needs to be, merged behind a feature flag for Serverless. Might be helpful to discuss this more with @yctercero.
  • (Optional) Review validation message that appears if users enable alert suppression on an EQL rule that uses a sequence query.

rylnd added a commit to WafaaNasr/kibana that referenced this issue Apr 5, 2024
@nastasha-solomon nastasha-solomon added Effort: Medium Issues that take moderate but not substantial time to complete and removed Effort: Small Issues that can be resolved quickly labels Apr 9, 2024
@rylnd
Copy link
Contributor

rylnd commented Apr 16, 2024

Recording here for posterity: @banderror made the point that we may want to reference the current "execute but with a warning, and ignoring suppression" behavior for EQL sequence rules. We do refer to "non-sequence EQL rules" throughout this PR, but perhaps we want to reference this behavior for explicitness' sake.

rylnd added a commit to elastic/kibana that referenced this issue Apr 17, 2024
…nce based queries (#176422)

# Summary

- Address adding suppression to EQL rules
https://github.com/elastic/security-team/issues/7773
- Milestone details https://github.com/elastic/security-team/issues/8432

## Checklist
- [x] Functional changes are hidden behind a feature flag. If not
hidden, the PR explains why these changes are being implemented in a
long-living feature branch.
- [x] Functional changes are covered with a test plan and automated
tests. [Test plan](https://github.com/elastic/security-team/pull/9155)
- [ ] Stability of new and changed tests is verified using the [Flaky
Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner) in
both ESS and Serverless. By default, use 200 runs for ESS and 200 runs
for Serverless.
* Cypress ESS:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5686
* Cypress Serverless:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5687
* FTR ESS:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5688
* FTR Serverless:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5689
- [x] Comprehensive manual testing is done by two engineers: the PR
author and one of the PR reviewers. Changes are tested in both ESS and
Serverless.
- [x] Mapping changes are accompanied by a technical design document. It
can be a GitHub issue or an RFC explaining the changes. The design
document is shared with and approved by the appropriate teams and
individual stakeholders.
- [ ] (OPTIONAL) OpenAPI specs changes include detailed descriptions and
examples of usage and are ready to be released on
https://docs.elastic.co/api-reference. NOTE: This is optional because at
the moment we don't have yet any OpenAPI specs that would be fully
"documented" and "GA-ready" for publishing on
https://docs.elastic.co/api-reference.
- [x] Functional changes are communicated to the Docs team. A ticket is
opened in https://github.com/elastic/security-docs using the [`Internal
documentation request (Elastic
employees)`](https://github.com/elastic/security-docs/issues/new?assignees=&labels=&projects=&template=docs-request-internal.yaml&title=%5BRequest%5D+)
template. The following information is included: feature flags used,
target ESS version, planned timing for ESS and Serverless releases.
- [x] Check if in timeline we can show the suppression count column when
the user clicks on investigate on timeline for Eql suppressed Alerts
(#180976)

## Related Issues
* Sub-PRs
- Address EQL schema changes PR
#176391
- Adding Feature flag PR and updating the Frontend Part in Rule
Create/Edit #176398
- Adding Backend changes and FTR tests
#176597
- Fix Investigate in Timeline for the Suppressed Alerts
#177839
- Add Cypress e2e tests #177870
- Disable EQL sequence suppression in the UI and fix Cypress `after`
esArchive path #178531
- Docs Issue elastic/security-docs#4977
- Test plan https://github.com/elastic/security-team/pull/9155

## Screenshots/recordings

### Non-Sequence Suppression

1. Rule creation, Suppression based on a single value


https://github.com/elastic/kibana/assets/12671903/8d168bce-15d3-45c2-a5dc-238b3ac01626

2. Rule creation, Suppression based on an array of values
  

https://github.com/elastic/kibana/assets/12671903/0e3312a9-4eae-476b-9c1e-c68189bbaf95

3. Investigate In Timeline


https://github.com/elastic/kibana/assets/12671903/e10c8668-4d5b-4748-b8a1-678603b4a8a5


### Disabled Sequence Suppression

1. UI


https://github.com/elastic/kibana/assets/12671903/01faa649-ca8b-43e4-a398-42ab242e7a72

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Ryland Herrick <ryalnd@gmail.com>
Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
@nastasha-solomon
Copy link
Contributor

Thanks @banderror and @rylnd for the feedback. I think the warnings that display on the Rules page, the rule details page, and the rule execution log do a great job of communicating this temporary limitation.

Also AFAIK, the UI doesn't offer a way to configure suppression on an EQL rule that's using a sequence query. Users would have to use the create/update rule APIs if they wanted to do this, and suppression still wouldn't work after they enabled the rule. At that point, the warnings that @rylnd added the UI would pop up and inform users that their suppression configuration isn't supported.

@nastasha-solomon
Copy link
Contributor

ESS and Serverless docs merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: Medium Issues that take moderate but not substantial time to complete Feature: Rules Priority: High Issues that are time-sensitive and/or are of high customer importance Team: Detection Engine ui-copy v8.14.0
Projects
None yet
Development

No branches or pull requests

3 participants