Skip to content

[8.19] Expose frozen indices information on the rule health endpoint (#219703)#220540

Merged
denar50 merged 1 commit into8.19from
backport/8.19/pr-219703
May 9, 2025
Merged

[8.19] Expose frozen indices information on the rule health endpoint (#219703)#220540
denar50 merged 1 commit into8.19from
backport/8.19/pr-219703

Conversation

@denar50
Copy link
Contributor

@denar50 denar50 commented May 8, 2025

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

@denar50 denar50 requested a review from kibanamachine as a code owner May 8, 2025 15:51
@denar50 denar50 added the backport This PR is a backport of another PR label May 8, 2025
@denar50 denar50 enabled auto-merge (squash) May 8, 2025 15:51
## Summary
This is a follow up PR to expose the metric
`frozen_indices_queried_max_count` on the rule healthcheck endpoint.
This metric is an aggregation of the metric
`frozen_indices_queried_count` which is calculated upon rule execution.
Refer to [this PR](#218435) to see
more details about it.

## How to test this?
- Run Elastic locally with these additional parameters in order to
enable the frozen data tier: -E path.repo="/tmp" -E
xpack.searchable.snapshot.shared_cache.size=20GB.
- Use [this
tutorial](https://docs.elastic.dev/security-soution/analyst-experience-team/eng-prod/how-to/configure-local-frozen-tier)
to create the snapshot repository and an ILM policy. You can disable
rollover for the ILM policy and configure indices to be moved to frozen
after 0 days.
- Create an index manually and populate it with a couple of documents.
- Assign the ILM policy to the index you created in the previous step
and wait for it to be rolled to frozen. You can run this command to
speed up the process:
```
PUT /_cluster/settings
{
  "persistent": {
    "indices.lifecycle.poll_interval": "10s"
  }
}
```
You can confirm that the index is indeed in frozen by calling
```
GET <YOUR_IDX_HERE>/_ilm/explain
```
`phase` should be `frozen` and `step` should be `complete`.
- Create a rule querying the frozen index.
- Call the rule health endpoint with:
```
curl -X POST --user elastic:changeme "http://localhost:5601/internal/detection_engine/health/_rule?date_start=2025-04-29T09:07:39.489Z&date_end=2025-05-01T09:08:39.489Z" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -H 'kbn-xsrf: 123' \
  -H "x-elastic-internal-origin: Kibana" \
  --data '{"rule_id":"2f9780b5-7819-4685-ab8e-d817d3701d10"}'
```
You should see `frozen_indices_queried_max_count` populated with `1`.

(cherry picked from commit 0544125)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/rule_monitoring/detection_engine_health/health_endpoints.md
#	x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/detection_engine_health/event_log/aggregations/types.ts
@denar50 denar50 force-pushed the backport/8.19/pr-219703 branch from 8014431 to c7ac789 Compare May 8, 2025 20:33
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

@denar50 denar50 merged commit 14083f6 into 8.19 May 9, 2025
8 checks passed
@denar50 denar50 deleted the backport/8.19/pr-219703 branch May 9, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants