metadata

Checks a metadata key against an argument according to a chosen operator.

metadata:
operator: equals_cs
key: ""
arg: ""

Fields

operator

string An operator to apply.

key

string The key of the metadata field to check.

arg

string An argument to check against. For some operators this field not be required.

part

number The index of a message within a batch to test the condition against. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Operators

enum

Checks whether the contents of a metadata key matches one of the defined enum values.

metadata:
operator: enum
key: foo
arg:
- bar
- baz
- qux
- quux

equals

Checks whether the contents of a metadata key matches an argument. This operator is case insensitive.

metadata:
operator: equals
key: foo
arg: bar

equals_cs

Checks whether the contents of a metadata key matches an argument. This operator is case sensitive.

metadata:
operator: equals_cs
key: foo
arg: BAR

exists

Checks whether a metadata key exists.

metadata:
operator: exists
key: foo

greater_than

Checks whether the contents of a metadata key, parsed as a floating point number, is greater than an argument. Returns false if the metadata value cannot be parsed into a number.

metadata:
operator: greater_than
key: foo
arg: 3

has_prefix

Checks whether the contents of a metadata key match one of the provided prefixes. The arg field can either be a singular prefix string or a list of prefixes.

metadata:
operator: has_prefix
key: foo
arg:
- foo
- bar
- baz

less_than

Checks whether the contents of a metadata key, parsed as a floating point number, is less than an argument. Returns false if the metadata value cannot be parsed into a number.

metadata:
operator: less_than
key: foo
arg: 3

regexp_partial

Checks whether any section of the contents of a metadata key matches a regular expression (RE2 syntax).

metadata:
operator: regexp_partial
key: foo
arg: "1[a-z]2"

regexp_exact

Checks whether the contents of a metadata key exactly matches a regular expression (RE2 syntax).

metadata:
operator: regexp_partial
key: foo
arg: "1[a-z]2"