Splunk® Data Stream Processor

DSP Function Reference

Acrobat logo Download manual as PDF


On April 3, 2023, Splunk Data Stream Processor will reach its end of sale, and will reach its end of life on February 28, 2025. If you are an existing DSP customer, please reach out to your account team for more information.
This documentation does not apply to the most recent version of Splunk® Data Stream Processor. For documentation on the most recent version, go to the latest release.
Acrobat logo Download topic as PDF

Mathematical

abs

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

DSL example

Returns 1.2.

abs(-1.2);

ceiling

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
number
Function Output
double

DSL example

Returns 2 as a double.

ceiling(1.2);

exponential

Mathematical evaluation function that takes a number X and returns the exponential eˣ 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

DSL example

Returns 2.718281828459045 as a double.

exp(1);

floor

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

DSL example

Returns 1 as a double.

floor(1.2);

logarithm

This function takes either one or two numeric arguments and returns the logarithm of the first argument X using the second argument Y as the base. If the second argument Y is omitted, this function evaluates the logarithm of number X 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
input: number
base: number
Function Output
double

DSL example

Returns 4 as a double.

log(16,2);

natural logarithm

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
number
Function Output
double

DSL example

Returns 0 as a double.

ln(1);

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

DSL example

Returns 3.14159265358979323846 as a double.

pi();

power of base

Mathematical evaluation function that takes two numeric arguments, X and Y, and returns XY 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

DSL example

Returns 4 as a double.

pow(2,2);

round value

Mathematical evaluation function that takes two numeric arguments, X and Y, and returns X rounded to the amount of decimal places specified by Y. Use this scalar function with the eval or the filter streaming functions.

Function Input
num_dec: integer
value: double
Function Output
double

DSL example

Returns 2.56 as a double.

round(cast(2.555d, "double"), 2);

round value

Mathematical evaluation function that takes a numeric argument X and returns X rounded to the nearest whole number. Use this scalar function with the eval or the filter streaming functions.

Function Input
double
Function Output
double

DSL example

Returns 3.0 as a double.

round(cast(2.555d, "double"));

square root

Mathematical evaluation function that takes a number X 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
number
Function Output
double

DSL example

Returns 10 as a double.

sqrt(100);
Last modified on 31 October, 2019
PREVIOUS
Date and Time
  NEXT
Multivalue

This documentation applies to the following versions of Splunk® Data Stream Processor: 1.0.0


Was this documentation topic helpful?


You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters