Dashboards & Visualizations

Conditional statements/output

Branden
Builder

I have a search that checks to see if a process particular process is running. Simple enough.

In my dashboard, I want users to be able to see if that process is running. But rather than displaying the process, I'd like to use a "" to simply say "Yes" or "No".

I know Splunk can count the number of results, but is there a way to tell the dashboard to display "Yes" if count>0 and "No" if count==0?

Thanks!

Tags (2)
0 Karma

southeringtonp
Motivator

There are a few options, but a simple way is to use eval to pull out a new field.

Try this:

... | eval yesno=if(count==0, "No", "Yes")

The docs page for eval has some other examples: http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Eval

To use it in your XML, you might do something like this:

<module name="HiddenSearch" layoutPanel="panel_row1_col1" autoRun="True">
    <param name="search">YOUR TERMS HERE | eval yesno=if(count==0, "No", "Yes") | rangemap field=count severe=0-0 default=low</param>
    <module name="SingleValue">
        <param name="field">yesno</param>
        <param name="classField">range</param>
    </module>
</module>

Branden
Builder

I had to change to "

0 Karma

southeringtonp
Motivator

The N/A sounds like you have a SingleValue module that's looking at the wrong field. See edits to answer above.

0 Karma

Branden
Builder

Actually I figured out the mis-matched tag issue... but it's still not providing the expected behavior. It's reporting "N/A". But I think you've pointed me in the right direction. I'll try to figure it out from here. Thanks!

0 Karma

Branden
Builder

Thanks for the reply.
Unfortunately, this doesn't seem to work in the context of a dashboard. I keep getting a "mismatched tag:" error when I had the eval statement. The same thing happens when I use a regex. In the search bar it's fine, but not in an XML file...

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...