Core Plugins and tasks PurgeLogs

Core Plugins and tasks PurgeLogs

Certified

Purge execution and trigger logs.

Deletes logs in bulk by namespace/flow/execution filters and optional level/date ranges. Requires namespace authorization when targeting other namespaces.

For performance, use this instead of per-execution deletions; consider keeping ERROR logs by filtering logLevels.

yaml
type: io.kestra.plugin.core.log.PurgeLogs

Purge all logs that has been created more than one month ago.

yaml
    id: purge
    namespace: system

    tasks:
      - id: purge_logs
        type: io.kestra.plugin.core.log.PurgeLogs
        endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"

Purge all logs that has been created more than one month ago, but keep error logs.

yaml
    id: purge
    namespace: system

    tasks:
      - id: purge
        type: io.kestra.plugin.core.log.PurgeLogs
        endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"
        logLevels:
          - TRACE
          - DEBUG
          - INFO
          - WARN
Properties

The maximum date to be purged

All logs before this date will be purged.

The number of log rows deleted per batch

Only applies on MySQL. When set, deletion runs in batches of this size using DELETE ... LIMIT n to stay within group_replication_transaction_size_limit. When not set, all matching rows are deleted in a single transaction.

The Execution ID of the logs to be purged

The flow ID of the logs to be purged

You need to provide the namespace property if you want to purge flow logs.

SubTypestring
Possible Values
ERRORWARNINFODEBUGTRACE

The levels of the logs to be purged

If not set, log for all levels will be purged.

Namespace of logs that need to be purged

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

Defaulttrue

Whether to purge execution logs

If set to true, logs attached to an execution will be purged. Default is true.

Defaulttrue

Whether to purge non-execution logs

If set to true, logs not attached to an execution (e.g. trigger logs) will be purged. Default is true.

The minimum date to be purged

All logs after this date will be purged.

Default0

The total count of deleted logs

Default0

The count of deleted execution logs

Default0

The count of deleted non-execution logs