Splunk Search

Why Splunk is telling me that my eval expression is malformed?

tcmarquesi
Explorer

I'm trying to evaluate the normal distribuiton's PDF into my search as follows:

... | eval prob=(1/sqrt(2*pi()*sigma^2))*exp(-((x-mi)^2)/(2*sigma^2))

And I'm getting this error message:

Error in 'eval' command: The expression is malformed. Expected ).

What am I doing wrong? I tested the expression on Excel and it works fine...

Tags (2)
0 Karma
1 Solution

sundareshr
Legend

I haven't tested this, but at first glance, it could be because of the the power of function. Change all occurences of sigma^2 to pow(sigma, 2). So your formula s/b written like this

(1/sqrt(2*pi()*pow(sigma,2)))*exp(-(pow((x-mi),2))/(2*pow(sigma, 2)))

View solution in original post

sundareshr
Legend

I haven't tested this, but at first glance, it could be because of the the power of function. Change all occurences of sigma^2 to pow(sigma, 2). So your formula s/b written like this

(1/sqrt(2*pi()*pow(sigma,2)))*exp(-(pow((x-mi),2))/(2*pow(sigma, 2)))

tcmarquesi
Explorer

Thank you!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...