Skip to content

abs - Take absolute value of a number

Returns the absolute value of number. Useful for computing the total difference between two values.

Syntax

abs(number: number): number

Arguments

NameTypeRequiredDescription
numbernumbertrueThe value which will be made positive

Example: The difference between two timestamp fields

In this example, a new field is made called time_difference that is populated by the numerical difference between a field first_timestamp and second_timestamp. The use of the abs function means the user doesn't need to know which timestamp is greater.

source logs | create time_difference from abs(first_timestamp - second_timestamp)