Source
yaml
id: purge-disk-space-interactively
namespace: blueprints
description: This flow can be manually executed to clean the storage of this
Kestra instance within a selected period while targeting specific item types.
labels:
type: ADMIN_PROCESS
inputs:
- id: start
type: DATETIME
required: true
- id: end
type: DATETIME
required: true
- id: what_to_purge
type: MULTISELECT
values:
- LOGS
- EXECUTIONS
- METRICS
- STORAGE
- id: allow_destructive_action
type: STRING
description: "BE CAREFUL! This is a destructive action. Type 'ALLOW' if you're
sure you want to proceed with the deletion."
dependsOn:
inputs:
- start
- end
- what_to_purge
condition: "{{ inputs.start is not empty and inputs.end is not empty and
inputs.what_to_purge is not empty}}"
required: true
validator: ^ALLOW$
tasks:
- id: purge_logs
type: io.kestra.plugin.core.log.PurgeLogs
runIf: "{{ inputs.what_to_purge contains 'LOGS' }}"
startDate: "{{ inputs.start }}"
endDate: "{{ inputs.end }}"
- id: purge_internal_storage
type: io.kestra.plugin.core.execution.PurgeExecutions
purgeExecution: false
purgeMetric: false
purgeStorage: true
purgeLog: false
runIf: "{{ inputs.what_to_purge contains 'STORAGE' }}"
- id: purge_metrics
type: io.kestra.plugin.core.execution.PurgeExecutions
purgeExecution: false
purgeMetric: true
purgeStorage: false
purgeLog: false
runIf: "{{ inputs.what_to_purge contains 'METRICS' }}"
- id: purge_executions
type: io.kestra.plugin.core.execution.PurgeExecutions
purgeExecution: true
purgeMetric: false
purgeStorage: false
purgeLog: false
runIf: "{{ inputs.what_to_purge contains 'EXECUTIONS' }}"
pluginDefaults:
- type: io.kestra.plugin.core.execution.PurgeExecutions
values:
startDate: "{{ inputs.start }}"
endDate: "{{ inputs.end }}"
About this blueprint
API Kestra
This flow helps manage storage by purging logs, executions, metrics, and stored files based on user-defined inputs.
- Users specify a start and end date, as well as the types of data to purge (logs, executions, metrics, or internal storage).
- The flow contains multiple purge tasks, one per type of data.
- A safeguard is in place requiring users to confirm destructive actions by typing "ALLOW."
Note that purged data cannot be recovered, so use this flow with caution.
More Related Blueprints