The Benthos AWK processor comes with custom functions listed in this document. These functions can be overridden by functions in the program.
Attempts to find a JSON value in the input message payload by a dot separated
path and returns it as a string. This function is always available even when the
json codec is not used.
Attempts to set a JSON value in the input message payload identified by a dot
separated path. This function is always available even when the json codec is
not used.
Generates a valid JSON object of key value pair arguments. The arguments are variadic, meaning any number of pairs can be listed. The value will always resolve to a string regardless of the value type. E.g. the following call:
create_json_object("a", "1", "b", 2, "c", "3")
Would result in this string:
{"a":"1","b":"2","c":"3"}
Generates a valid JSON array of value arguments. The arguments are variadic, meaning any number of values can be listed. The value will always resolve to a string regardless of the value type. E.g. the following call:
create_json_array("1", 2, "3")
Would result in this string:
["1","2","3"]
Set a metadata key for the message to a value. The value will always resolve to a string regardless of the value type.
Get the value of a metadata key from the message.
Returns the current unix timestamp (the number of seconds since 01-01-1970).
Attempts to parse a date string by detecting its format and returns the equivalent unix timestamp (the number of seconds since 01-01-1970).
Attempts to parse a date string according to a format and returns the equivalent unix timestamp (the number of seconds since 01-01-1970).
The format is defined by showing how the reference time, defined to be
Mon Jan 2 15:04:05 -0700 MST 2006 would be displayed if it were the value.
Returns the current unix timestamp in nanoseconds (the number of nanoseconds since 01-01-1970).
Attempts to parse a date string by detecting its format and returns the equivalent unix timestamp in nanoseconds (the number of nanoseconds since 01-01-1970).
Attempts to parse a date string according to a format and returns the equivalent unix timestamp in nanoseconds (the number of nanoseconds since 01-01-1970).
The format is defined by showing how the reference time, defined to be
Mon Jan 2 15:04:05 -0700 MST 2006 would be displayed if it were the value.
Formats a unix timestamp. The format is defined by showing how the reference
time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006 would be displayed if it
were the value.
The format is optional, and if omitted RFC3339 (2006-01-02T15:04:05Z07:00)
will be used.
Formats a unix timestamp in nanoseconds. The format is defined by showing how
the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006 would be
displayed if it were the value.
The format is optional, and if omitted RFC3339 (2006-01-02T15:04:05Z07:00)
will be used.
Prints a Benthos log message at a particular log level. The log level is
optional, and if omitted the level INFO will be used.