Skip to content

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

actions:
- convert: {}
JSON
{
"actions": [
{
"convert": {}
}
]
}

A ✓ marks a field that accepts a context variable such as {{ VARIABLE }}.

Behaviour
Field Type Required Description
auto boolean (bool) Allows auto-conversion, which helps when there are many fields.
Default: false
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.
Default: false
Formatting
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
General
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()
Mappings
Field Type Required Description
conversions Conversions[] Simple conversions.
units Units[] Unit conversions.
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, ssv-to-array, tsv-to-array, …
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, gigabits, gigabits-per-second, …
from From optional unit we are converting from.
Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, gigabits, gigabits-per-second, …
Value Aliases Name Description
keep keep Pass through null or empty values
default default Convert bool fields to false, num fields to 0 or str fields to an empty string
Value Aliases Name Description
currency currency
percent percent
comma-number comma-number
plain plain
Value Aliases Name 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
Value Aliases Name Description
warn warn
default default
drop drop
Value Aliases Name 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
Value Aliases Name 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
Value Aliases Name 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