forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Alerting] Log ES query when query fails (elastic#187785)
Resolves elastic#185889 ## Summary Logs ES query at `warn` level when query throws an error. This aids in debugging query errors during rule execution without having to turn debug logging on. Also added a wrapper to the core logger for use within the alerting task runner that will include the rule ID and rule type ID as tags in any message logged during rule execution. This should allow us to filter for log messages for a specific rule. ## To verify 1. Create a rule where the query will fail and let it run (I created an ES query rule with bad DSL) 2. Logs should show the query that was sent: Note the error log already existed. The warning log was added in this PR. ``` [2024-07-08T14:58:39.442-04:00][WARN ][plugins.alerting.es-query] executing query for rule .es-query:7240c70d-00c6-4f44-9ef2-5fd496bfe46b in space default - {"allow_no_indices":true,"index":[".kibana-event-log*"],"size":100,"ignore_unavailable":true,"track_total_hits":true,"body":{"docvalue_fields":[{"field":"@timestamp","format":"strict_date_optional_time"}],"query":{"bool":{"filter":[{"boop":{}},{"bool":{"filter":[{"range":{"@timestamp":{"lte":"2024-07-08T18:58:39.440Z","gte":"2024-07-08T18:53:39.440Z","format":"strict_date_optional_time"}}}]}}]}},"aggs":{},"sort":[{"@timestamp":{"order":"desc","format":"strict_date_optional_time||epoch_millis"}}]}} - with options {"meta":true} and 300000ms requestTimeout [2024-07-08T14:58:39.461-04:00][ERROR][plugins.alerting.es-query] Executing Rule default:.es-query:7240c70d-00c6-4f44-9ef2-5fd496bfe46b has resulted in Error: x_content_parse_exception Caused by: parsing_exception: unknown query [boop] did you mean [bool]? Root causes: parsing_exception: unknown query [boop] did you mean [bool]?, caused by: "unknown query [boop] did you mean [bool]?,[1:117] unknown field [boop]" - ResponseError: x_content_parse_exception Caused by: parsing_exception: unknown query [boop] did you mean [bool]? Root causes: parsing_exception: unknown query [boop] did you mean [bool]? at KibanaTransport.request (/Users/ying/Code/kibana/node_modules/@elastic/transport/src/Transport.ts:564:17) at processTicksAndRejections (node:internal/process/task_queues:95:5) ``` --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
7d6c18a
commit de13fca
Showing
9 changed files
with
436 additions
and
82 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
Oops, something went wrong.