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

[Security Solution] Truncated error messages during rule execution #147918

Open
Tracked by #165878
xcrzx opened this issue Dec 21, 2022 · 4 comments
Open
Tracked by #165878

[Security Solution] Truncated error messages during rule execution #147918

xcrzx opened this issue Dec 21, 2022 · 4 comments
Labels
bug Fixes for quality problems that affect the customer experience consider-next Feature:Detection Alerts Security Solution Detection Alerts Feature Feature:Rule Monitoring Security Solution Detection Rule Monitoring area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.

Comments

@xcrzx
Copy link
Contributor

xcrzx commented Dec 21, 2022

Summary

During the search phase of rule execution, thrown error messages are truncated, making it difficult to identify the root cause of the error.

See SDHs for example:

  1. https://github.com/elastic/sdh-security-team/issues/508
  2. https://github.com/elastic/sdh-security-team/issues/501
  3. https://github.com/elastic/sdh-security-team/issues/500

All of them have error messages logged without root cause in both the Kibana logs and the rule execution log:

search_after_bulk_create threw an error ResponseError: search_phase_execution_exception: [siem.queryRule][AWS Config Resource Deletion][rule id 92e3cf40-75bf-11ed-89b7-0bebc4b98e27][rule uuid 7024e2a0-315d-4334-bb1a-552d604f27bc][exec id 456fdc0b-91e6-4261-9815-5a88a27288f7][space default]

image

We need to find a way to extract useful information from Elasticsearch errors and log it with the error. Sometimes it is specified in the reason field, for example:

{
  "message": "status_exception",
  "statusCode": 400,
  "attributes": {
    "type": "status_exception",
    "reason": "error while executing search",
    "caused_by": {
      "type": "search_phase_execution_exception",
      "reason": "Partial shards failure",
      "phase": "query",
      "grouped": true,
      "failed_shards": [
        {
          "shard": 0,
          "index": ".ds-elastic-cloud-logs-8-2022.03.05-000001",
          "node": "FAfhiKFgQRub0foBuI0llg",
          "reason": {
            "type": "illegal_argument_exception",
            "reason": "Field [timestamp] of type [keyword] is not supported for aggregation [date_histogram]"
          }
        }
      ],
      "caused_by": {
        "type": "",
        "reason": ": Field [timestamp] of type [keyword] is not supported for aggregation [date_histogram]",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "Field [timestamp] of type [keyword] is not supported for aggregation [date_histogram]"
        }
      }
    }
  }
}
@xcrzx xcrzx added bug Fixes for quality problems that affect the customer experience triage_needed Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team labels Dec 21, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@xcrzx xcrzx added Feature:Rule Monitoring Security Solution Detection Rule Monitoring area and removed triage_needed labels Dec 21, 2022
@banderror banderror self-assigned this Dec 28, 2022
@banderror
Copy link
Contributor

All these issues could have been fixed by elastic/elastic-transport-js#52 which was propagated to Kibana in #148521. We need to verify that it fixes the issues mentioned in this ticket.

@banderror
Copy link
Contributor

@marshallmain and @elastic/security-detections-response-alerts folks, would you be able to help here with verifying that the error cases from the linked SDHs are now resolved? I think this is more related to rule execution logic and how errors are created, rather than the rule execution logging mechanism and features, so I'd rely on your knowledge of the detection engine here.

@banderror banderror added Team:Detection Alerts Security Detection Alerts Area Team impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Feature:Detection Alerts Security Solution Detection Alerts Feature and removed triage_needed labels Mar 21, 2023
@yctercero yctercero added Team:Detection Engine Security Solution Detection Engine Area and removed Team:Detection Alerts Security Detection Alerts Area Team labels May 13, 2023
@yctercero yctercero added this to the DR - Serverless Ungated milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience consider-next Feature:Detection Alerts Security Solution Detection Alerts Feature Feature:Rule Monitoring Security Solution Detection Rule Monitoring area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Projects
None yet
Development

No branches or pull requests

4 participants