Snapshot lifecycle management retention
editSnapshot lifecycle management retention
editYou can include a retention policy in an SLM policy to automatically delete old snapshots.
Retention runs as a cluster-level task and is not associated with a particular policy’s schedule.
The retention criteria are evaluated as part of the retention task, not when the policy executes.
For the retention task to automatically delete snapshots,
you need to include a retention
object in your SLM policy.
To control when the retention task runs, configure
slm.retention_schedule
in the cluster settings.
You can define the schedule as a periodic or absolute cron schedule.
The slm.retention_duration
setting limits how long
SLM should spend deleting old snapshots.
You can update the schedule and duration dynamically with the update settings API. You can run the retention task manually with the execute retention API.
The retention task only considers snapshots initiated through SLM policies, either according to the policy schedule or through the execute lifecycle API. Manual snapshots are ignored and don’t count toward the retention limits.
To retrieve information about the snapshot retention task history, use the get stats API:
GET /_slm/stats
The response includes the following statistics:
{ "retention_runs": 13, "retention_failed": 0, "retention_timed_out": 0, "retention_deletion_time": "1.4s", "retention_deletion_time_millis": 1404, "policy_stats": [ { "policy": "daily-snapshots", "snapshots_taken": 1, "snapshots_failed": 1, "snapshots_deleted": 0, "snapshot_deletion_failures": 0 } ], "total_snapshots_taken": 1, "total_snapshots_failed": 1, "total_snapshots_deleted": 0, "total_snapshot_deletion_failures": 0 }
Number of times retention has been run |
|
Number of times retention failed while running |
|
Number of times retention hit the |
|
Total time spent deleting snapshots by the retention process |
|
Number of snapshots created by the "daily-snapshots" policy that have been deleted |
|
Number of snapshots that failed to be deleted |
|
Total number of snapshots deleted across all policies |
|
Total number of snapshot deletion failures across all policies |