-
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][Detections] Preview Rule: Make it possible to configure the time interval and look-back time #137102
[Security Solution][Detections] Preview Rule: Make it possible to configure the time interval and look-back time #137102
Conversation
…figure the time interval and look-back time (elastic#4362)
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
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.
Just glanced at the changes real quick and skipped a thorough review and testing: I'm not really familiar with the internal implementation of rule preview and I don't want to block this PR.
High-level, the changes LGTM 👍
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.
This is all looking great so far! One thing we'll need to update though is the rule run from the backend, specifically right here. The way the logic is currently set up, we just use now
(or moment()
in this case) to set up the timerange in which the rule runs. Then we use the interval count to step backwards and get to the startedAt
time we use in the rule execution runs. With the addition of the advanced rule preview and the arbitrary dates we can now use, we'll have to set this up differently in the case of a user, for instance, running a rule from 20 days to 19 days ago (just a random example). I think the best way to do that is calculate and pass in an optional param alongside invocationCount
called finalInvocationStartTime
or something and have that essentially be the end time the user specifies. Then we can do something similar to the current logic where we use the invocation count that you've calculated and step backwards to run the rule over the user specified time range, not just based on the relative-to-now
math we're currently using
...ck/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @e40pud |
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.
Looks good, thanks for making those changes!
Summary
These changes add advanced rule preview options which allows power users to have control over the timeframe, rule interval and look-back time.
Fixes https://github.com/elastic/security-team/issues/4362
Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers