Core Plugins and tasks PurgeStorage

Core Plugins and tasks PurgeStorage

Certified

Purge execution files from the internal storage by last-modified date.

Irreversible. Always start with dryRun: true and review the counters before re-running with dryRun: false.

When using per-namespace dedicated storage (EE), this task must be configured for each namespace to be able to clean the dedicated storage.

Deletes execution files whose last-modified timestamp falls between startDate and endDate. The primary use case is reclaiming files left behind by flows that no longer exist — files that PurgeExecutions cannot reach because there is no execution record to delete.

namespace matching is recursive: namespace: io.kestra also purges sub-namespaces such as io.kestra.team. Omit namespace to purge across every namespace under the tenant. A sub-namespace configured with its own dedicated storage is not reached by recursion — target it explicitly.

Set endDate to (or before) your PurgeExecutions retention window so that only files belonging to already-purged executions are deleted.

yaml
type: io.kestra.plugin.core.storage.PurgeStorage

Delete execution storage files older than 7 days for a namespace.

yaml
id: purge_storage
namespace: system

tasks:
  - id: purge
    type: io.kestra.plugin.core.storage.PurgeStorage
    namespace: company.team
    endDate: "{{ now() | dateAdd(-7, 'DAYS') }}"
    dryRun: false
Properties

Only purge files last modified before this date.

Set this to (or before) your PurgeExecutions retention window so only files of already-purged executions are deleted.

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
Defaulttrue

If true, only report what would be deleted without deleting anything.

The flow ID to be purged.

Requires namespace to also be set.

Namespace whose execution storage files should be purged.

Recursive: sub-namespaces are also purged (e.g. io.kestra reaches io.kestra.team), except sub-namespaces with their own dedicated storage, which must be targeted explicitly. Omit to purge across every namespace under the tenant.

Only purge files last modified after this date.

Default0

Number of storage objects deleted (always 0 when dryRun is true).

Default0

Number of executions with at least one file in the date window (preserved when dryRun is true).

Default0

Number of execution storage subtrees scanned.

Number of storage objects deleted (always 0 when dryRun is true).

Number of execution storage subtrees matched (preview when dryRun is true).

Number of execution storage subtrees scanned.