Core Plugins and tasks PurgeExecutions

Core Plugins and tasks PurgeExecutions

Certified

Purge executions, logs, metrics, and storage files.

Deletes historical execution data by namespace/flow, bounded by startDate/endDate, and optionally filtered by states. Each category can be toggled (purgeExecution, purgeLog, purgeMetric, purgeStorage).

Respects Namespace authorization checks (there must be purge rights on the target namespace); default batch size is 100. Irreversible — use carefully in production.

yaml
type: io.kestra.plugin.core.execution.PurgeExecutions

Purge all flow execution data for flows that ended more than one month ago.

yaml
id: purgeexecutions
type: io.kestra.plugin.core.execution.PurgeExecutions
id: purge_exections
namespace: system

tasks:
  - id: purge
    type: io.kestra.plugin.core.execution.PurgeExecutions
    endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"
    states:
      - KILLED
      - FAILED
      - WARNING
      - SUCCESS
Properties

The date before which data should be purged.

All data of flows executed before this date will be purged.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Default100

The size of the bulk delete

Deletion is done in batches of this many executions (default 100). If executions have a large number of logs, use PurgeLogs instead to control how many log rows are deleted per transaction.

The flow ID to be purged

You need to provide the namespace properties if you want to purge a flow.

Namespace whose flows need to be purged, or namespace of the flow that needs to be purged

If flowId isn't provided, this is a namespace prefix, else the namespace of the flow.

Defaulttrue

Flag specifying whether to purge executions

Defaulttrue

Flag specifying whether to purge execution logs

This will only purge logs from executions, not from triggers, and it will do it execution by execution. The io.kestra.plugin.core.log.PurgeLogs task is a better fit to purge, as it will purge logs in bulk and will also purge logs not tied to an execution like trigger logs.

Defaulttrue

Flag specifying whether to purge execution's metrics.

Defaulttrue

Flag specifying whether to purge execution's files from the Kestra's internal storage

The date after which data should be purged

All data of flows executed after this date will be purged.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

The state of the executions to be purged

If not set, executions for any states will be purged.

Default0

The count of deleted execution outputs

Default0

The count of deleted executions

Default0

The count of deleted logs

Default0

The count of deleted metrics

Default0

The count of deleted storage files

Default0

The count of deleted task outputs