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!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...