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

[SIEM][Detection Engine] Modified gap detection util to accept all dateMath formats #56055

Merged
merged 10 commits into from
Jan 31, 2020

Conversation

yctercero
Copy link
Contributor

@yctercero yctercero commented Jan 27, 2020

Summary

Modify signals utils gap detection functions to make use of @elastic/datemath. Should account for more edge cases - such as value to or from being ISO strings, invalid strings, or things other than their defaults.

Prior functionality allowed to to only be now and from to only be now-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:

[warning][plugins][siem] Signal rule name: "Query with a rule id", id: [ID HERE], rule_id: "query-rule-id" has a time gap of [TIME GAP HERE] minutes, and could be missing signals within that time. Consider increasing your look behind time or adding more Kibana instances.

Note that it seems there's checks for to and from to be valid date strings in ES so if you attempt to create a rule that does not use an ISO string, now, or now-x you'll get an error of ES yelling at you. In create_rules_schema.ts we're just checking for them to be strings.

Follow up to #54547

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@yctercero yctercero marked this pull request as ready for review January 30, 2020 19:56
@yctercero yctercero requested review from FrankHassanabad and removed request for FrankHassanabad January 30, 2020 20:02
@yctercero yctercero changed the title Edited date/time file comment. [SIEM][Detection Engine] Modified gap detection util to accept all dateMath formats Jan 30, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@FrankHassanabad FrankHassanabad left a 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

@yctercero yctercero merged commit e24863e into elastic:master Jan 31, 2020
Copy link
Contributor

@dhurley14 dhurley14 left a 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!

yctercero added a commit to yctercero/kibana that referenced this pull request Jan 31, 2020
…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>
yctercero added a commit that referenced this pull request Feb 19, 2020
…teMath formats (#56055) (#56535)

* Partial commit - Modified gap detection util to accept all dateMath formats.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@yctercero yctercero deleted the datetimes_fix branch July 20, 2020 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants