Grok TransformItems

Grok TransformItems

Certified

Parse and structure items from a UTF-8 text or Ion file using Grok expressions

The TransformItems task is similar to the famous Logstash Grok filter from the ELK stack. It is particularly useful for transforming unstructured data such as logs into a structured, indexable, and queryable data structure.

The source file is read line by line and each line is evaluated independently. Plain-text files are supported alongside Ion/JSON content, while non-matching rows are ignored. Multi-line records such as stack traces are therefore treated as separate entries rather than being preserved as a single item.

The TransformItems ships with all the default patterns as defined. You can find them here: https://github.com/kestra-io/plugin-transform/tree/main/plugin-transform-grok/src/main/resources/patterns.

yaml
type: io.kestra.plugin.transform.grok.TransformItems

Parse each line of a plain-text log file supplied through a FILE input with Grok.

yaml
id: grok_transform_items
namespace: company.team

inputs:
  - id: file
    type: FILE

tasks:
  - id: transform_items
    type: io.kestra.plugin.transform.grok.TransformItems
    pattern: "%{TIMESTAMP_ISO8601:logdate} %{LOGLEVEL:loglevel} %{GREEDYDATA:message}"
    from: "{{ inputs.file }}"
Properties

The file to be transformed

Must be a kestra:// internal storage URI pointing to a UTF-8 plain-text or Ion/JSON file. Each line is matched independently, so plain-text logs are processed one physical line at a time.

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, break on first match

The first successful match by grok will result in the task being finished. Set to false if you want the task to try all configured patterns.

Defaultfalse

If true, keep empty captures

When an optional field cannot be captured, the empty field is retained in the output. Set false if you want empty optional fields to be filtered out.

Defaulttrue

If true, only store named captures from grok

The Grok pattern to match

Custom pattern definitions

A map of pattern-name and pattern pairs defining custom patterns to be used by the current tasks. Patterns matching existing names will override the pre-existing definition.

SubTypestring

The list of Grok patterns to match

SubTypestring

List of user-defined pattern directories

Directories must be paths relative to the working directory.