Splunk Search

How do I remove negative numbers from an eval?

matt
Splunk Employee
Splunk Employee

I have a search which runs an eval statement. The problem is every couple of times a day the numbers its pulling (they are incremental numbers) are reset. This of course means the last number received is higher then the first number received in the search and results in a negative value. I want to throw this number out entirely. How do I go about this?

Example Problem:

eval FOO = firstFOO-lastFOO
Where firstFOO=10 and lastFOO is 1024
Foo will now equal -1014 which completely messes up the graphs.

Usually this is an incrementing number, but this counter gets reset when the application does.

Tags (2)
1 Solution

araitz
Splunk Employee
Splunk Employee
| eval FOO = if(firstFOO<lastFOO,null,firstFOO-lastFOO)

View solution in original post

araitz
Splunk Employee
Splunk Employee
| eval FOO = if(firstFOO<lastFOO,null,firstFOO-lastFOO)
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...