Core Plugins and tasks PurgeAuditLogs

Core Plugins and tasks PurgeAuditLogs

Certified

Purge audit logs older than a certain date.

This task can be used to save space in the database by purging audit logs older than a certain date.

yaml
type: io.kestra.plugin.ee.core.log.PurgeAuditLogs

Purge audit logs older than one month.

yaml
id: audit_log_cleanup
namespace: system
tasks:
  - id: purge_audit_logs
    type: io.kestra.plugin.ee.core.log.PurgeAuditLogs
    description: Purge audit logs older than 1 month
    endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"

Purge audit logs related to FLOW & EXECUTION permission created more than one month ago.

yaml
id: purgeauditlogs
type: io.kestra.plugin.ee.core.log.PurgeAuditLogs
endDate: "{{ now() | dateAdd(-1, 'MONTHS') }}"
resources:
- FLOW
- EXECUTION
Properties

The maximum date to be purged

All audit logs older than this date will be purged. We recommend using this property rather than startDate as your Audit Log retention policy.

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

The number of audit logs deleted per batch

When set, deletion runs in bounded batches instead of a single request. On Elasticsearch this avoids one long-running delete that the server can close (ConnectionClosedException) on very large purges. On JDBC it only takes effect on MySQL (batched with DELETE ... LIMIT); other databases always delete in a single request. When not set, all matching audit logs are deleted in a single request.

Namespace for which audit logs should be purged

This property declares a namespace prefix (or namespace of a specific flow if flowId is also provided) to be purged.

SubTypestring
Possible Values
FLOWEXECUTIONTRIGGERNAMESPACEKVSTOREREUSABLE_INPUTSDASHBOARDSECRETCREDENTIALBLUEPRINTAPPAUDITLOGSYSTEM_SETTINGSTENANT_SETTINGSTESTSUITEASSETUSERGROUPROLEBINDINGSERVICE_ACCOUNTINVITATIONCOPILOTMCP_SERVERSUPPORTPOLICYCASEPROMOTION_TARGETAPP_EXECUTIONNAMESPACE_FILETESTSUITE_RUNTENANT_ACCESSSECURITY_INTEGRATIONCASE_TEMPLATEBANNERKILL_SWITCHTENANTVERSIONED_PLUGINWORKER_GROUPWORKER_QUEUEINSTANCEUNKNOWN

The resources to be purged

The resources of audit logs to be purged; by default, the task will purge all audit logs including all resources.

The minimum date to be purged

All audit logs created after this date will be purged. Use this option only if you want to purge recently generated logs after a certain date.

SubTypestring
Possible Values
READCREATEUPDATEDELETELOGINLOGOUTIMPERSONATELOGIN_FAILUREACCOUNT_LOCKEDPROMOTEUNKNOWN

The type of actions to be purged

Use this option if you want to purge only specific actions like CREATE, READ, UPDATE, or DELETE. By default, the task will purge all types of actions.

Default0

The count of deleted audit logs