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

[7.15] [Security Solution][Detections] Truncate lastFailureMessage for siem-detection-engine-rule-status documents (#112257) #115166

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

banderror
Copy link
Contributor

Backports the following commits to 7.15:

@banderror banderror self-assigned this Oct 15, 2021
@banderror banderror requested review from a team as code owners October 15, 2021 11:16
@banderror banderror changed the base branch from master to 7.15 October 15, 2021 11:16
…r siem-detection-engine-rule-status documents (elastic#112257)

**Ticket:** elastic#109815

**Background:** `siem-detection-engine-rule-status` documents stores the `lastFailureMessage` a string which is indexed as `type: "text"` but some failure messages are so large that these documents are up to 26MB. These large documents cause migrations to fail because a batch of 1000 documents easily exceed Elasticsearch's `http.max_content_length` which defaults to 100mb.

This PR truncates `lastFailureMessage` and `lastSuccessMessage` in the following cases:

1. When we write new or update existing status SOs:
    - The lists of errors/warnings are deduped -> truncated to max `20` items -> joined to a string
    - The resulting strings are truncated to max `10240` characters
2. When we migrate `siem-detection-engine-rule-status` SOs to 7.15.2:
    - The two message fields are truncated to max `10240` characters

Delete any items that are not applicable to this PR.

- [ ] [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
@pgayvallet
Copy link
Contributor

It doesn't seem this PR is impacted any code owner by the core team, may I ask why the review request?

@banderror
Copy link
Contributor Author

Sorry @pgayvallet, I think reviewers were added automatically for some reason. I'll remove them from the PR.

@banderror banderror removed request for a team October 15, 2021 11:35
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

  • 💔 Build #161341 failed b84531596aacc1f8293f2904e7b48dd69a91ae81
  • 💔 Build #161342 failed b84531596aacc1f8293f2904e7b48dd69a91ae81

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

cc @banderror

@banderror banderror merged commit 1465ae8 into elastic:7.15 Oct 15, 2021
@banderror banderror deleted the backport/7.15/pr-112257 branch October 15, 2021 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Truncate lastFailureMessage for siem-detection-engine-rule-status documents
3 participants