round()
Rounds the number to the specified number of digits. It returns null if an argument value or the digit cannot be processed.
Syntax
round(NUM_EXPR[, NUM_DIGITS])
Required Parameter
NUM_EXPR
- Expression that returns int, short, long, float, or double
NUM_DIGITS
- Number of digits to which you want to round the number argument. If you specify a negative number as
NUM_DIGITS
, the function rounds to the left of the decimal point
Usage
json "{}" | eval round=round(1.0) => 1
json "{}" | eval round=round(1.6) => 2
json "{}" | eval round=round(1.47, 1) => 1.5
json "{}" | eval round=round(1837, -2) => 1800
json "{}" | eval round=round(5) => 5