Splunk Search

Single Value Color Change

3666142
Path Finder

I have a panel that is a single value that only shows the Health Status as "UP" or "DOWN".  If it is "UP" I want it to be green. If it is "DOWN" I want it to be red.

How can I do this in the source code?

This is a query the shows what the panel is doing.

index=index_name 
| rename msg.event.healthStatus as healthStatus
| dedup healthStatus
| table healthStatus

0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@3666142 

Can you please try this?

 

<dashboard>
  <label>Up_Down_single_View</label>
  <row>
    <panel>
      <single>
        <search>
          <query>index=index_name 
| rename msg.event.healthStatus as healthStatus
| dedup healthStatus
| table healthStatus | eval severity=if(healthStatus ="UP",1,4) | rangemap field=severity low=0-2 default=severe</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </single>
    </panel>
  </row>
</dashboard>

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

3666142
Path Finder

Close, but not exactly there. It's one panel. 

This query

 index=index_name 
| rename msg.event.healthStatus as healthStatus
| dedup healthStatus
| table healthStatus

The table will only show the healthStatus. healthStatus will only equal UP or DOWN. If the value of healthStatus is UP, I want the word UP to be green. If the value of healthStatus is DOWN, I want it to be RED. Only one value will be displayed at a time because I want it to be a single value display.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@3666142 

Can you please try this?

 

<dashboard>
  <label>Up_Down_single_View</label>
  <row>
    <panel>
      <single>
        <search>
          <query>index=index_name 
| rename msg.event.healthStatus as healthStatus
| dedup healthStatus
| table healthStatus | eval severity=if(healthStatus ="UP",1,4) | rangemap field=severity low=0-2 default=severe</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </single>
    </panel>
  </row>
</dashboard>

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

kamlesh_vaghela
SplunkTrust
SplunkTrust

@3666142 

may be rangemap will help you.

Can you please try this?

 

<dashboard>
  <label>Up_Down_single_View</label>
  <row>
    <panel>
      <single>
        <search>
          <query>| makeresults | eval value="UP" | table value | eval severity=if(value="UP",1,4) | rangemap field=severity low=0-2 default=severe</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </single>
    </panel>
    <panel>
      <single>
        <search>
          <query>| makeresults | eval value="DOWN" | table value | eval severity=if(value="UP",1,4) | rangemap field=severity low=0-2 default=severe</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </single>
    </panel>
  </row>
</dashboard>

 

 

Screenshot 2021-06-22 at 9.33.19 PM.png

 

Important links:

https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/Rangemap

https://docs.splunk.com/Documentation/Splunk/latest/Viz/SingleValueFormatting#Migration_for_rangemap...

 

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...