Blueprints

Purge execution data including logs, metrics and outputs on a schedule

About this blueprint

Trigger

This flow will purge all execution data older than 1 month, including logs, metrics and outputs. In this specific flow, we chose to purge only the successful executions in order to keep the audit trail of failed executions. However, you can leave the states field empty to purge all execution data, regardless of the execution status, or adjust it to your needs.

It is recommended to run this flow on a monthly schedule to keep your Kestra instance clean and save storage space.

Note that this flow will not purge the flow definitions or the namespace files — your code will be safe. Only the execution data will be purged.

yaml
id: purge_storage
namespace: system

tasks:
  - id: clean_up_storage
    type: io.kestra.plugin.core.storage.Purge
    endDate: "{{ trigger.date | dateAdd(-1, 'MONTHS') }}"
    purgeExecution: true
    purgeLog: true
    purgeMetric: true
    purgeStorage: true
    states:
      - SUCCESS

triggers:
  - id: monthly
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 9 1 * *" # every month at 9am on the 1st day of the month

Purge

Schedule

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra