-
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] Modified gap detection util to accept all dateMath formats #56055
Conversation
…th `from` being any string (invalid, ISO string, now, now-x).
Pinging @elastic/siem (Team:SIEM) |
@elasticmachine merge upstream |
x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/utils.test.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
Checked it out, tested it with a query that was 30 seconds, the Gap detection looks to be operating.
Thanks for letting me know you modeled the tests after the others from Kibana core with regards to mocking the times. That was a good thing for me to learn.
LGTM! Merge away and backport
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.
Forgot to submit review but tested locally and everything looked great!
…teMath formats (elastic#56055) * Partial commit - got tests working and `getGapBetweenRuns` working with `from` and `to` being any string (invalid, ISO string, now, now-x). Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Modify signals utils gap detection functions to make use of @elastic/datemath. Should account for more edge cases - such as value
to
orfrom
being ISO strings, invalid strings, or things other than their defaults.Prior functionality allowed
to
to only benow
andfrom
to only benow-x
.To test using default rule schedule values, start Kibana -> post a rule -> shut down Kibana for 6+ minutes. You should see an error like the following show up:
Note that it seems there's checks for
to
andfrom
to be valid date strings in ES so if you attempt to create a rule that does not use an ISO string,now
, ornow-x
you'll get an error of ES yelling at you. Increate_rules_schema.ts
we're just checking for them to be strings.Follow up to #54547
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 IE11Any text added follows EUI's writing guidelines, uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)Documentation was added for features that require explanation or tutorialsThis was checked for keyboard-only and screenreader accessibilityFor maintainers
This was checked for breaking API changes and was labeled appropriatelyThis includes a feature addition or change that requires a release note and was labeled appropriately