Add fleet policy revisions cleanup task#242612
Merged
MichelLosier merged 24 commits intoelastic:mainfrom Nov 24, 2025
Merged
Conversation
Contributor
Author
|
/ci |
Contributor
Author
|
Open for early review. Next steps here:
|
Contributor
Author
|
/ci |
nchaulet
approved these changes
Nov 20, 2025
Member
nchaulet
left a comment
There was a problem hiding this comment.
a few suggestions, code LGTM 🚀
x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/index.ts
Show resolved
Hide resolved
...plugins/shared/fleet/server/tasks/fleet_policy_revisions_cleanup/cleanup_policy_revisions.ts
Show resolved
Hide resolved
Contributor
|
Pinging @elastic/fleet (Team:Fleet) |
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
Resolves: elastic#119963 PR to add new Kibana config to allow list: elastic/cloud#149322 * Adds the background task `FleetPolicyRevisionsCleanupTask` which removes excess policy revisions from the `.fleet-policies` index * Enabled by default, disabled by new feature flag: ``` xpack.fleet.experimentalFeatures: enableFleetPolicyRevisionsCleanupTask: true ``` * Configurable with the following: ``` xpack.fleet.fleetPolicyRevisionsCleanup: interval: string // Time interval expression. Default: '1h' max_revisions: number // Maximum amount of policy revisions. Default: 10. max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100. ``` * Also adds an internal endpoint for the same operation: ``` POST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1 { "maxRevisions": number, // max revisions a policy should have "maxPolicies": number, // max policies to process } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
10 tasks
Contributor
|
@MichelLosier would it be possible to backport this to 8.19? |
Contributor
|
Starting backport for target branches: 8.19 |
Contributor
|
Starting backport for target branches: 8.19 |
Contributor
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
1 similar comment
Contributor
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
MichelLosier
added a commit
to MichelLosier/kibana
that referenced
this pull request
Dec 9, 2025
Resolves: elastic#119963 PR to add new Kibana config to allow list: elastic/cloud#149322 * Adds the background task `FleetPolicyRevisionsCleanupTask` which removes excess policy revisions from the `.fleet-policies` index * Enabled by default, disabled by new feature flag: ``` xpack.fleet.experimentalFeatures: enableFleetPolicyRevisionsCleanupTask: true ``` * Configurable with the following: ``` xpack.fleet.fleetPolicyRevisionsCleanup: interval: string // Time interval expression. Default: '1h' max_revisions: number // Maximum amount of policy revisions. Default: 10. max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100. ``` * Also adds an internal endpoint for the same operation: ``` POST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1 { "maxRevisions": number, // max revisions a policy should have "maxPolicies": number, // max policies to process } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit d2e01dc) # Conflicts: # x-pack/platform/plugins/shared/fleet/common/experimental_features.ts # x-pack/platform/plugins/shared/fleet/moon.yml # x-pack/platform/test/fleet_api_integration/config.base.ts # x-pack/platform/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts
MichelLosier
added a commit
to MichelLosier/kibana
that referenced
this pull request
Dec 9, 2025
Resolves: elastic#119963 PR to add new Kibana config to allow list: elastic/cloud#149322 * Adds the background task `FleetPolicyRevisionsCleanupTask` which removes excess policy revisions from the `.fleet-policies` index * Enabled by default, disabled by new feature flag: ``` xpack.fleet.experimentalFeatures: enableFleetPolicyRevisionsCleanupTask: true ``` * Configurable with the following: ``` xpack.fleet.fleetPolicyRevisionsCleanup: interval: string // Time interval expression. Default: '1h' max_revisions: number // Maximum amount of policy revisions. Default: 10. max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100. ``` * Also adds an internal endpoint for the same operation: ``` POST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1 { "maxRevisions": number, // max revisions a policy should have "maxPolicies": number, // max policies to process } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit d2e01dc) # Conflicts: # x-pack/platform/plugins/shared/fleet/common/experimental_features.ts # x-pack/platform/plugins/shared/fleet/common/types/index.ts # x-pack/platform/plugins/shared/fleet/moon.yml # x-pack/platform/plugins/shared/fleet/server/config.ts # x-pack/platform/plugins/shared/fleet/server/plugin.ts # x-pack/platform/test/fleet_api_integration/config.base.ts # x-pack/platform/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts
Contributor
Author
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
MichelLosier
added a commit
to MichelLosier/kibana
that referenced
this pull request
Dec 9, 2025
Resolves: elastic#119963 PR to add new Kibana config to allow list: elastic/cloud#149322 * Adds the background task `FleetPolicyRevisionsCleanupTask` which removes excess policy revisions from the `.fleet-policies` index * Enabled by default, disabled by new feature flag: ``` xpack.fleet.experimentalFeatures: enableFleetPolicyRevisionsCleanupTask: true ``` * Configurable with the following: ``` xpack.fleet.fleetPolicyRevisionsCleanup: interval: string // Time interval expression. Default: '1h' max_revisions: number // Maximum amount of policy revisions. Default: 10. max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100. ``` * Also adds an internal endpoint for the same operation: ``` POST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1 { "maxRevisions": number, // max revisions a policy should have "maxPolicies": number, // max policies to process } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit d2e01dc) # Conflicts: # x-pack/platform/plugins/shared/fleet/common/constants/routes.ts # x-pack/platform/plugins/shared/fleet/common/experimental_features.ts # x-pack/platform/plugins/shared/fleet/common/types/index.ts # x-pack/platform/plugins/shared/fleet/moon.yml # x-pack/platform/plugins/shared/fleet/server/config.test.ts # x-pack/platform/plugins/shared/fleet/server/config.ts # x-pack/platform/plugins/shared/fleet/server/plugin.ts # x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/handlers.ts # x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/index.ts # x-pack/platform/plugins/shared/fleet/server/types/rest_spec/agent_policy.ts # x-pack/platform/test/fleet_api_integration/apis/agent_policy/index.js # x-pack/platform/test/fleet_api_integration/config.base.ts # x-pack/platform/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts # x-pack/platform/test/serverless/functional/test_suites/common/examples/search/index.ts
MichelLosier
added a commit
that referenced
this pull request
Dec 9, 2025
# Backport This will backport the following commits from `main` to `9.2`: - [Add fleet policy revisions cleanup task (#242612)](#242612) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michel Losier","email":"michel.losier@elastic.co"},"sourceCommit":{"committedDate":"2025-11-24T18:53:39Z","message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","ci:cloud-deploy","backport:version","v9.3.0","v9.2.3","v9.1.9","v8.19.9"],"title":"Add fleet policy revisions cleanup task","number":242612,"url":"https://github.com/elastic/kibana/pull/242612","mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/242612","number":242612,"mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},{"branch":"9.2","label":"v9.2.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
MichelLosier
added a commit
that referenced
this pull request
Dec 9, 2025
# Backport This will backport the following commits from `main` to `8.19`: - [Add fleet policy revisions cleanup task (#242612)](#242612) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michel Losier","email":"michel.losier@elastic.co"},"sourceCommit":{"committedDate":"2025-11-24T18:53:39Z","message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","ci:cloud-deploy","backport:version","v9.3.0","v9.2.3","v9.1.9","v8.19.9"],"title":"Add fleet policy revisions cleanup task","number":242612,"url":"https://github.com/elastic/kibana/pull/242612","mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/242612","number":242612,"mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},{"branch":"9.2","label":"v9.2.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
MichelLosier
added a commit
that referenced
this pull request
Dec 10, 2025
# Backport This will backport the following commits from `main` to `9.1`: - [Add fleet policy revisions cleanup task (#242612)](#242612) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michel Losier","email":"michel.losier@elastic.co"},"sourceCommit":{"committedDate":"2025-11-24T18:53:39Z","message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","ci:cloud-deploy","backport:version","v9.3.0","v9.2.3","v9.1.9","v8.19.9"],"title":"Add fleet policy revisions cleanup task","number":242612,"url":"https://github.com/elastic/kibana/pull/242612","mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/242612","number":242612,"mergeCommit":{"message":"Add fleet policy revisions cleanup task (#242612)\n\nResolves: https://github.com/elastic/kibana/issues/119963\nPR to add new Kibana config to allow list:\nhttps://github.com/elastic/cloud/pull/149322\n\n* Adds the background task `FleetPolicyRevisionsCleanupTask` which\nremoves excess policy revisions from the `.fleet-policies` index\n* Enabled by default, disabled by new feature flag:\n```\n xpack.fleet.experimentalFeatures:\n enableFleetPolicyRevisionsCleanupTask: true\n```\n* Configurable with the following:\n\n```\nxpack.fleet.fleetPolicyRevisionsCleanup:\n interval: string // Time interval expression. Default: '1h'\n max_revisions: number // Maximum amount of policy revisions. Default: 10.\n max_policies_per_run: number // Maximum policies to delete revisions from per run. Default 100.\n```\n* Also adds an internal endpoint for the same operation:\n\n```\nPOST kbn:/internal/fleet/agent_policies/_cleanup_revisions?apiVersion=1\n{\n \"maxRevisions\": number, // max revisions a policy should have\n \"maxPolicies\": number, // max policies to process\n}\n```\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d2e01dc368b018be3f09de5eb65e2ba5e2ef95a0"}},{"branch":"9.2","label":"v9.2.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Contributor
|
Thanks for the backports! |
MichelLosier
added a commit
that referenced
this pull request
Jan 14, 2026
Adds documentation for the `xpack.fleet.fleetPolicyRevisionsCleanup` configuration added in #242612 elastic/cloud#149322 --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves: #119963
PR to add new Kibana config to allow list: https://github.com/elastic/cloud/pull/149322
FleetPolicyRevisionsCleanupTaskwhich removes excess policy revisions from the.fleet-policiesindexRelease notes
FleetPolicyRevisionsCleanupTaskwhich removes excess policy revisions from the.fleet-policiesindexDetails
max_policies_per_runsorted by document count, filtered down to those exceeding themax_revisionsmax_revisionscutoff, which is calculated from the minimum revision used by agents for that policy or the latest revision idxThe idea here is to optimize for low resource environments, and slowly burn down revisions for environments that have had revisions counts run away. The exposed configuration allows for more aggressive use for those that need it.
Manual testing
This PR introduces a
--revisionsflag for the create_agents script to generate a set amount of revisions per policy.Example:
Will create 100 policies with 5 agents and 1000 revisions each.
Configure kibana.dev.yml to the task parameters, as described above, you want to test with.
Check revisions counts in the kibana dev console:
Additionally the new internal endpoint can also be used to perform the same operation in the dev console:
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.