Purge
Available on: >= 0.18.0
Use purge tasks to remove old executions and logs, helping reduce storage usage.
The recommended approach is to combine io.kestra.plugin.core.execution.PurgeExecutions
with io.kestra.plugin.core.log.PurgeLogs
.
PurgeExecutions
: deletes execution recordsPurgeLogs
: removes bothExecution
andTrigger
logs in bulk
Together, these replace the legacy io.kestra.plugin.core.storage.Purge
task with a faster and more reliable process (~10x faster).
The Enterprise Edition also includes PurgeAuditLogs
.
id: purge
namespace: company.myteam
description: |
This flow will remove all executions and logs older than 1 month.
We recommend running it daily to prevent storage issues.
tasks:
- id: purge_executions
type: io.kestra.plugin.core.execution.PurgeExecutions
endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"
purgeLog: false
- id: purge_logs
type: io.kestra.plugin.core.log.PurgeLogs
endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"
triggers:
- id: daily
type: io.kestra.plugin.core.trigger.Schedule
cron: "@daily"
Purge tasks permanently delete data. Always test in non-production environments first.
Purge tasks vs. UI deletion
Purge tasks perform hard deletion, permanently removing records and reclaiming storage. In contrast, deleting items in the UI is a soft deletion—the data is hidden but retained (e.g., revision history and past executions can reappear if a flow with the same ID is recreated).
This distinction matters for compliance and troubleshooting: purge flows are best for cleaning up space, while UI deletions preserve history for auditability.
Purge tasks do not affect Kestra’s internal queues. Queue retention is managed separately via JDBC Cleaner (for database) or topic retention (for Kafka).
Was this page helpful?