Convert
Convert (convert)
Convert fields from one type to another, supporting simple and unit conversions Convert fields from one type to another, e.g. strings to numbers.
Transform json
Minimal example
actions: - convert: {}JSON
{ "actions": [ { "convert": {} } ]}Contents
Fields
| Field | Type | Required | Description |
|---|---|---|---|
description General | string | describe this step. | |
condition General | lua-expression (string) | Only run this action if the specified condition is met. Examples: 2 * count() | |
auto Behaviour | boolean (bool) | Allows auto-conversion, which helps when there are many fields. | |
null-behaviour Behaviour | Null Behaviour | Controls what occurs when a field’s value is null or empty. Allowed values: keep, default | |
conversions Mappings | Conversions[] | Simple conversions. | |
units Mappings | Units[] | Unit conversions. | |
format Formatting | Format | Apply a predefined format template before conversion. Allowed values: currency, percent, comma-number, plain | |
preprocess Formatting | Preprocess[] | Preprocess operations applied before conversion. Allowed values: trim, strip-whitespace, remove-currency-literal, remove-percent-literal, remove-thousands-separator | |
on-error Formatting | On Error | Behaviour when conversion fails. Allowed values: warn, default, drop | |
suppress-warnings Behaviour | boolean (bool) | Suppress warnings generated by this action. |
General
Show fields
| Field | Type | Required | Description |
|---|---|---|---|
description | string | describe this step. | |
condition | lua-expression (string) | Only run this action if the specified condition is met. Examples: 2 * count() |
Behaviour
Show fields
| Field | Type | Required | Description |
|---|---|---|---|
auto | boolean (bool) | Allows auto-conversion, which helps when there are many fields. | |
null-behaviour | Null Behaviour | Controls what occurs when a field’s value is null or empty. Allowed values: keep, default | |
suppress-warnings | boolean (bool) | Suppress warnings generated by this action. |
Mappings
Show fields
| Field | Type | Required | Description |
|---|---|---|---|
conversions | Conversions[] | Simple conversions. | |
units | Units[] | Unit conversions. |
Formatting
Show fields
| Field | Type | Required | Description |
|---|---|---|---|
format | Format | Apply a predefined format template before conversion. Allowed values: currency, percent, comma-number, plain | |
preprocess | Preprocess[] | Preprocess operations applied before conversion. Allowed values: trim, strip-whitespace, remove-currency-literal, remove-percent-literal, remove-thousands-separator | |
on-error | On Error | Behaviour when conversion fails. Allowed values: warn, default, drop |
Schema
- Conversions Fields
- Units Fields
- Null Behaviour Options
- Conversions - Conversion Options
- Units - To Options
- Units - From Options
- Format Options
- Preprocess Options
- On Error Options
Conversions Fields
| Field | Type | Required | Description |
|---|---|---|---|
field | string | ✅ | event field to be converted in-place. |
conversion | Conversion | ✅ | conversion operation. Allowed values: str, num, json, bytes-to-string, bool, array, split, csv-to-array, … |
Units Fields
| Field | Type | Required | Description |
|---|---|---|---|
field | string | ✅ | event field to be converted in-place. |
to | To | ✅ | the unit we are converting to. Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, … |
from | From | optional unit we are converting from. Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, … |
Null Behaviour Options
| Value | Description |
|---|---|
keep | Pass through null or empty values |
default | Convert bool fields to false, num fields to 0 or str fields to an empty string |
Conversions - Conversion Options
| Value | Description |
|---|---|
str | Str |
num | Num |
json | Json |
bytes-to-string | Bytes To String |
bool | Bool |
array | Array |
split | Split |
csv-to-array | Csv To Array |
ssv-to-array | Ssv To Array |
tsv-to-array | Tsv To Array |
null | Null |
url | Url |
auto | Auto |
Units - To Options
| Value | Description |
|---|---|
bits | Bits |
bits-per-second | Bits Per Second |
bytes | Bytes |
bytes-per-second | Bytes Per Second |
days | Days |
exabytes | Exabytes |
gibibytes | Gibibytes |
gibits | Gibits |
gigabits | Gigabits |
gigabits-per-second | Gigabits Per Second |
gigabytes | Gigabytes |
gigabytes-per-second | Gigabytes Per Second |
hours | Hours |
kibibytes | Kibibytes |
kibits | Kibits |
kilobits | Kilobits |
kilobits-per-second | Kilobits Per Second |
kilobytes | Kilobytes |
kilobytes-per-second | Kilobytes Per Second |
mebibytes | Mebibytes |
megabits | Megabits |
megabits-per-second | Megabits Per Second |
megabytes | Megabytes |
megabytes-per-second | Megabytes Per Second |
mibits | Mibits |
microseconds | Microseconds |
milliseconds | Milliseconds |
minutes | Minutes |
nanoseconds | Nanoseconds |
petabytes | Petabytes |
seconds | Seconds |
tebibytes | Tebibytes |
terabits | Terabits |
terabits-per-second | Terabits Per Second |
terabytes | Terabytes |
terabytes-per-second | Terabytes Per Second |
tibits | Tibits |
Units - From Options
| Value | Description |
|---|---|
bits | Bits |
bits-per-second | Bits Per Second |
bytes | Bytes |
bytes-per-second | Bytes Per Second |
days | Days |
exabytes | Exabytes |
gibibytes | Gibibytes |
gibits | Gibits |
gigabits | Gigabits |
gigabits-per-second | Gigabits Per Second |
gigabytes | Gigabytes |
gigabytes-per-second | Gigabytes Per Second |
hours | Hours |
kibibytes | Kibibytes |
kibits | Kibits |
kilobits | Kilobits |
kilobits-per-second | Kilobits Per Second |
kilobytes | Kilobytes |
kilobytes-per-second | Kilobytes Per Second |
mebibytes | Mebibytes |
megabits | Megabits |
megabits-per-second | Megabits Per Second |
megabytes | Megabytes |
megabytes-per-second | Megabytes Per Second |
mibits | Mibits |
microseconds | Microseconds |
milliseconds | Milliseconds |
minutes | Minutes |
nanoseconds | Nanoseconds |
petabytes | Petabytes |
seconds | Seconds |
tebibytes | Tebibytes |
terabits | Terabits |
terabits-per-second | Terabits Per Second |
terabytes | Terabytes |
terabytes-per-second | Terabytes Per Second |
tibits | Tibits |
Format Options
| Value | Description |
|---|---|
currency | Currency |
percent | Percent |
comma-number | Comma Number |
plain | Plain |
Preprocess Options
| Value | Description |
|---|---|
trim | Trim |
strip-whitespace | Strip Whitespace |
remove-currency-literal | Remove Currency Literal |
remove-percent-literal | Remove Percent Literal |
remove-thousands-separator | Remove Thousands Separator |
On Error Options
| Value | Description |
|---|---|
warn | Warn |
default | Default |
drop | Drop |