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!

Cisco Data Fabric from Architecture to Investigation, Better SOC Visibility, and More ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

The Trust Gap: Why a Data Foundation is Fundamental to an Agentic Enterprise

The Trust Gap: Why a data foundation is fundamental to an  Agentic Enterprise.   Agentic AI is transforming ...

Data Management Digest – September 2026

    Welcome to the September 2026 edition of Data Management Digest! September brought a fresh wave of ...