The query and analysis function of Log Service supports analyzing logs by using mathematical calculation functions. By combining query statements with mathematical calculation functions, you can perform mathematical calculation to the log query results. 

Mathematical operators

Mathematical operators support plus sign (+), minus sign (-), multiplication sign (*), division sign (/), and percent sign (%),  which can be used in the SELECT clause.

Example:

*|select avg(latency)/100 , sum(latency)/count(1)

Description of mathematical calculation function

Log Service supports the following operating functions.

Function name Meaning
abs(x) Returns the absolute value of column x.
Cbrt (X) Returns the cube root of column x.
ceiling(x) Returns the number rounded up to the nearest integer of column x.
cosine_similarity(x,y) Returns the cosine similarity between the sparse vectors x and y.
degrees Converts radians to degrees.
e() Returns the natural constant.
exp(x) Returns the exponent of the natural constant.
floor(x) Returns the number rounded down to the nearest integer of column x.
from_base(string,radix) Returns the string interpreted in the base-radix notation.
ln(x) Returns the natural logarithm.Returns the natural log.
log2(x) Returns the base-2 logarithm of x.
log10(x) Returns the base-10 logarithm of x.
log(x,b) Returns the base-b logarithm of x.
pi() Returns π.
pow(x,b) Returns x to the power of b.
radians(x) Converts degrees to radians.
rand() Returns a random number.
random(0,n) Returns a random number in the range of [0,n).
round(x) Returns x rounded to the nearest integer.
round(x, y) Returns x rounded to the nearest integer.
sqrt(x) Returns the square root of x.
to_base(x, radix) Returns the base-radix representation of x.
truncate(x) Returns x rounded to integer by dropping digits after decimal point.
acos(x) Returns the arc cosine.
Asin (X) Returns the arc sine.
atan(x) Returns the arc tangent.
atan2(y,x) Returns the arc tangent of y/x.
cos(x) Returns the cosine.
sin(x) Returns the sine.
cosh(x) Returns the hyperbolic cosine.
tan(x) Returns the tangent.
tanh(x) Returns the hyperbolic tangent.
Infinity () Returns the double maximum value.
is_infinity(x) Determines whether it is the maximum value or not.
is_finity(x) Determines whether it is the maximum value or not.
is_nan(x) Determines whether it is a number or not.