abs()

Table of Contents

Definition

abs() returns the absolute value of a number. The function creates a new column with the absolute value of a given numerical value.

Examples

The following example gives the absolute value of numbers in balance column. spath command is used to extract JSON values and table to show only _time, balance, and test columns for clarity.

index=crud earliest=-5y
| spath
| eval test = abs(balance)
| table _time, balance, test
Screenshot of the previous example’s results for abs().

Further Reading