Kv
Filter plugin : Kvâ
- Author: InterestingLab
- Homepage: https://interestinglab.github.io/seatunnel-docs
- Version: 1.0.0
Descriptionâ
Extract all Key-Values of the specified string field with configured field_split
, which are often used to parse the url parameter.
Optionsâ
name | type | required | default value |
---|---|---|---|
default_values | array | no | [] |
exclude_fields | array | no | [] |
field_prefix | string | no | |
field_split | string | no | & |
include_fields | array | no | [] |
source_field | string | no | raw_message |
target_field | string | no | __root__ |
value_split | string | no | = |
default_values [array]â
Default values can be set by default_values
by key=defalut_value
(key and value are separated by =
).
Multiple default values are specified as follows: default_values = ["mykey1=123", "mykey2=seatunnel"]
exclude_fields [array]â
Fields in the exclude_fields
will be abandoned.
field_prefix [string]â
A string to prepend to all of the extracted keys.
field_split [string]â
A string of characters to use as single-character field delimiters for parsing key-value pairs.
include_fields [array]â
An array specifying the parsed keys which should be added to the event.
source_field [string]â
Source field.
target_field [string]â
All extracted fields will be put into target_field
.
value_split [string]â
A non-empty string of characters to use as single-character value delimiters for parsing key-value pairs.
Examplesâ
With
target_field
kv {
source_field = "message"
target_field = "kv_map"
field_split = "&"
value_split = "="
}- Input
+-----------------+
|message |
+-----------------+
|name=ricky&age=23|
|name=gary&age=28 |
+-----------------+- Output
+-----------------+-----------------------------+
|message |kv_map |
+-----------------+-----------------------------+
|name=ricky&age=23|Map(name -> ricky, age -> 23)|
|name=gary&age=28 |Map(name -> gary, age -> 28) |
+-----------------+-----------------------------+
Without
target_field
kv {
source_field = "message"
field_split = "&"
value_split = "="
}- Input
+-----------------+
|message |
+-----------------+
|name=ricky&age=23|
|name=gary&age=28 |
+-----------------+- Output
+-----------------+---+-----+
|message |age|name |
+-----------------+---+-----+
|name=ricky&age=23|23 |ricky|
|name=gary&age=28 |28 |gary |
+-----------------+---+-----+