Splunk Search

How to color the field greater than or lower than or between?

jip31
Motivator

Hi

Im a report, I am doing a basic count on a field

| stats values(CycleCount00) as "Cycle count" by host

when "Cycle count" result is > 300, I need to color the field in red
when "Cycle count" result is between 200 and 300, I need to color the field in orange
when "Cycle count" result is < 200, I need to color the field in green

what is the better way to do this?
I have also tried this it doesnt let me to user greater or lower than...

       <format type="color" field="Cycle count">
          <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#FFFFFF"></colorPalette>
          <scale type="minMidMax"></scale>
        </format>

Ithought about the rangemap command but I dont succeed to use it
is anybody cant help me please?

0 Karma
1 Solution

to4kawa
Ultra Champion
<dashboard>
  <label>table sample</label>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults count=3
| streamstats count
| eval "Cycle count" = random() % 300 ,host="host_".count
| table host "Cycle count"</query>
          <earliest>0</earliest>
          <latest></latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <format type="color" field="Cycle count">
          <colorPalette type="list">[#53A051,#F1813F,#DC4E41]</colorPalette>
          <scale type="threshold">200,300</scale>
        </format>
      </table>
    </panel>
  </row>
</dashboard>

rangemap is not need.

View solution in original post

0 Karma

to4kawa
Ultra Champion
<dashboard>
  <label>table sample</label>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults count=3
| streamstats count
| eval "Cycle count" = random() % 300 ,host="host_".count
| table host "Cycle count"</query>
          <earliest>0</earliest>
          <latest></latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <format type="color" field="Cycle count">
          <colorPalette type="list">[#53A051,#F1813F,#DC4E41]</colorPalette>
          <scale type="threshold">200,300</scale>
        </format>
      </table>
    </panel>
  </row>
</dashboard>

rangemap is not need.

0 Karma

jip31
Motivator

perfect thanks

0 Karma

nickhills
Ultra Champion

You should be able to use rangemap for this.

Try:

...| stats values(CycleCount00) as "Cycle count" by host|rangemap field="Cycle count" low=0-200 elevated=201-300 default=severe

In your table, add:

<option name="classField">range</option>
If my comment helps, please give it a thumbs up!
0 Karma

jip31
Motivator

when I add the option name range I have a issue :
Unknown option name="classField" for node="table"

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...