Splunk Search

Rewriting value of field if value is negative

mcwomble
Path Finder

Hi,

I would like to rewrite bogus field values that are negative to 0. For example I would like to run the following search and plot a timechart of all 3 values, but change any that are negative to 0.

timechart max(mms_run_time_hour) as "MMS Run Time" max(vfn_run_time_hour) as "VFN Run Time" max(sms_run_time_hour)

Thanks

Tags (2)
0 Karma
1 Solution

Lowell
Super Champion

You can use an eval search command like this:

... | eval bogus_field=if(bogus_field>0, bogus_field, 0)

Or, perhaps even better:

... | eval bogus_field=max(bogus_field,0)

View solution in original post

Lowell
Super Champion

You can use an eval search command like this:

... | eval bogus_field=if(bogus_field>0, bogus_field, 0)

Or, perhaps even better:

... | eval bogus_field=max(bogus_field,0)
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...