Available on: >= 0.18.0

Purge old executions and logs to save disk space.

As your workflows grow, you may need to clean up old executions and logs to save disk space.

The recommended way to clean execution and logs is using a combination of io.kestra.plugin.core.execution.PurgeExecutions and the newly added io.kestra.plugin.core.log.PurgeLogs task as shown below. The PurgeLogs task removes all logs (both Execution logs and Trigger logs) in a performant batch operation. Combining those two together will give you the same functionality as the previous io.kestra.plugin.core.storage.Purge task but in a more performant and reliable way (roughly 10x faster).

yaml
id: purge
namespace: company.myteam
description: |
  This flow will remove all executions and logs older than 1 month.
  We recommend running this flow daily to avoid running out of disk space.

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"
Renamed Purge Tasks in 0.18.0

Was this page helpful?