-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ResponseOps] Elasticsearch query rule with ES|QL threshold validation (
#170463) Resolves #170360 ## Summary We should be throwing an error if a user tries to create an ESQL es query rule where `thresholdCompartor != '>'` or `threshold != 0` or `timeField` is not defined. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### To verify - Go to [dev tools](http://localhost:5601/app/dev_tools#/console) - Run the following and edit thresholdComparator, threshold, or timeField and verify that you see errors thrown. ``` POST kbn:/api/alerting/rule { "params": { "searchType": "esqlQuery", "esqlQuery": { "esql": """from kibana_sample_data_logs | keep bytes, clientip, host, geo.dest | where geo.dest != "GB" | stats sumbytes = sum(bytes) by clientip, host | WHERE sumbytes > 5000 | sort sumbytes desc | limit 10""" }, "timeWindowSize": 1, "timeWindowUnit": "d", "thresholdComparator": "<", "threshold": [ 1000 ], "size": 10, "timeField": "date" }, "consumer": "stackAlerts", "rule_type_id": ".es-query", "schedule": { "interval": "5d" }, "name": "test rule" } ``` (cherry picked from commit 0e7798a)
- Loading branch information
Showing
3 changed files
with
167 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters