All DSP releases prior to DSP 1.4.0 use Gravity, a Kubernetes orchestrator, which has been announced end-of-life. We have replaced Gravity with an alternative component in DSP 1.4.0. Therefore, we will no longer provide support for versions of DSP prior to DSP 1.4.0 after July 1, 2023. We advise all of our customers to upgrade to DSP 1.4.0 in order to continue to receive full product support from Splunk.
Mathematical
abs(value)
Mathematical evaluation function that returns a number's absolute value. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- number
- Function Output
- number
SPL2 examples
Returns the absolute values of the numeric field number
.
When working in the SPL View, you can write the function by using the following syntax.
... | eval absnum=abs(number);
Alternatively, you can use named arguments.
... | eval absnum=abs(value: number);
addition
For documentation on how to perform addition, see arithmetic operators.
ceil(value)
Mathematical evaluation function that rounds a number up to the next highest integer. Returns the result as a double. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- value: number
- Function Output
- double
SPL2 examples
The following examples return n=2.
When working in the SPL View, you can write the function by using the following syntax.
...| eval n=ceil(1.9);
Alternatively, you can use named arguments.
...| eval n=ceil(value: 1.9);
division
For documentation on how to perform division, see arithmetic operators.
exp(value)
Mathematical evaluation function that takes a number value
and returns the exponential evalue
as a double. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- number
- Function Output
- double
SPL2 example
Returns 2.718281828459045 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=exp(1);
Alternatively, you can use named arguments.
... | eval n=exp(value: 1);
floor(value)
Mathematical evaluation function that rounds a number down to the nearest integer. Returns the result as a double. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- number
- Function Output
- double
SPL2 examples
Returns 1 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=floor(1.2);
Alternatively, you can use named arguments.
... | eval n=floor(value: 1.2);
log(value, base)
This function takes either one or two numeric arguments and returns the logarithm of the first argument value
using the second argument base
as the base. If the second argument base
is omitted, this function evaluates the logarithm of number value
with base 10. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- value: number
- base: number
- Function Output
- double
SPL2 example
Returns 4 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=log(16,2);
Alternatively, you can use named arguments to list the arguments in any order.
... | eval n=log(base: 2, value: 16);
ln(value)
Mathematical evaluation function that takes a number and returns its natural logarithm as a double. Returns null for invalid values. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- value: number
- Function Output
- double
SPL2 examples
Returns 0 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=ln(1);
Alternatively, you can use named arguments.
... | eval n=ln(value: 1);
mod(left, right)
Mathematical evaluation function that takes two numbers, divides them, and returns the remainder. You can also compute the remainder with the %
character. See the second SPL2 example.
- Function Input
- left: number to be divided
- right: number to divide with
- Function Output
- number
1. SPL2 example
Returns 1.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n = mod(100,33) | ...;
2. SPL2 example
Returns 1.2999999999999998.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=5.3%2 | ...;
multiplication
For documentation on how to perform multiplication, see arithmetic operators.
pi()
Mathematical evaluation function that takes no arguments, but returns the constant pi to 20 digits of precision. Use this scalar function with the eval or the filter streaming functions.
- Function Input
- null
- Function Output
- double
SPL2 example
Returns 3.14159265358979323846 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=pi();
pow(base, exp)
Mathematical evaluation function that takes two numbers base
and exp
, and returns baseexp
as a double. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- base: number
- exp: number
- Function Output
- double
SPL2 examples
Returns 4 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=pow(2,2);
Alternatively, you can use named arguments to list the arguments in any order.
... | eval n=pow(exp: 2, base: 2);
randomint()
Mathematical evaluation function that takes no arguments, but returns a number ranging from 0 to 231-1 as an integer. Use this scalar function with the eval or the filter streaming functions.
- Function Input
- null
- Function Output
- integer
SPL2 example
Returns a random number between 0 and 231-1 as an integer.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=randomint();
round(value)
Takes a numeric arguments value
and returns the nearest whole number. Use this scalar function with the eval or the filter streaming functions.
- Function Input
- value: double
- Function Output
- double
SPL2 examples
Returns 3.0 as a double.
When working in the SPL View, you can write the function by using the following syntax.
...| eval n=round(cast(2.555d, "double"));
Alternatively, you can use named arguments.
...| eval n=round(value: cast(2.555d, "double"));
round(value, num_decimals)
Mathematical evaluation function that takes two numeric arguments, value
and num_decimals
, and returns value
rounded to the amount of decimal places specified by num_decimals
. Use this scalar function with the eval or the filter streaming functions.
- Function Input
- value: double
- num_decimals: integer
- Function Output
- double
SPL2 examples
Returns 2.56 as a double.
When working in the SPL View, you can write the function by using the following syntax.
...| eval n=round(2.555, 2);
Alternatively, you can use named arguments to list the arguments in any order.
...| eval n=round(num_decimals: 2, value: 2.555);
subtraction
For documentation on how to perform subtraction, see arithmetic operators.
sqrt(value)
Mathematical evaluation function that takes a number and returns its square root. Use this scalar function with the eval or the filter streaming functions. Numbers can be type int, long, float, or double.
- Function Input
- value: number
- Function Output
- double
SPL2 example
Returns 10 as a double.
When working in the SPL View, you can write the function by using the following syntax.
... | eval n=sqrt(100);
Alternatively, you can use named arguments to list the arguments in any order.
... | eval n=sqrt(value: 100);
Map | String manipulation |
This documentation applies to the following versions of Splunk® Data Stream Processor: 1.2.0, 1.2.1-patch02, 1.2.1, 1.2.2-patch02, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6
Feedback submitted, thanks!