number

Parses message contents into a 64-bit floating point number and performs an operator on it. In order to execute this processor on a sub field of a document use it with the process_field processor.

number:
operator: add
value: 0

The value field can either be a number or a string type. If it is a string type then this processor will interpolate functions within it, you can find a list of functions here.

For example, if we wanted to subtract the current unix timestamp from the field 'foo' of a JSON document {"foo":1561219142} we could use the following config:

process_field:
path: foo
result_type: float
processors:
- number:
operator: subtract
value: "${!timestamp_unix}"

Value interpolations are resolved once per message batch, in order to resolve it for each message of the batch place it within a for_each processor.

Operators

add

Adds a value.

subtract

Subtracts a value.

Fields

operator

string The operator to apply.

value

number A value used by the operator.

This field supports interpolation functions that are resolved batch wide.

parts

array An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. 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.