Archive
Highlighted

Stats to generate a single value background color AND font colour

Explorer

How to change stats to generate a single value background color AND font colour

Tags (1)
0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Legend

We need more information. stats cannot generate colors. In a dashboard, you can control the background color / value color for a single-value panel. If you could describe your data, what you need to calculate, and how you want to display it - then the community could probably make some good suggestions for you.

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Legend

Rangemap can be used to color Single Value visualization. https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rangemap#Examples

However, Splunk recommends controlling colors by configuring ranges in visualization properties instead. https://docs.splunk.com/Documentation/Splunk/latest/Viz/SingleValueFormatting#Migration_for_rangemap...




| eval message="Happy Splunking!!!"


Highlighted

Re: Stats to generate a single value background color AND font colour

Explorer

index="index" | rex "(?:[^\t\n]\t){16}(?P[^\t])"|rex "(?:[^\t\n]\t){17}(?P[^\t])" | rex maxmatch=0 "(?[^\<\"]*)"|eval reasonsubcode=substr(reasoncode,1,7) | search runcode=Failure AND reasonsub_code="CAM-AAA"
| stats count

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Legend

Hi x05311,
you can configure your Single Value Panel to use colors for font or background using UI.
You can use different colors for different ranges of your values.
if you want to have only one color for all values (number or background) you can set the same color for every value of your results.

In other words:

  • create your search with a stats command and a single value result;
  • save it in a dashboard as Single Value Panel;
  • set Format: Using Colors (by UI);
  • set the colors of the values ranges.

Bye.
Giuseppe

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Explorer

sorry Unable to do , can u pls provide full code :
my splunk code is :
index="index" | rex "(?:[^\t\n]\t){16}(?P[^\t])"|rex "(?:[^\t\n]\t){17}(?P[^\t])" | rex maxmatch=0 "(?[^\<\"]*)"|eval reasonsubcode=substr(reasoncode,1,7) | search runcode=Failure AND reasonsub_code="CAM-AAA"
| stats count

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Communicator

sorry i could not copy full xml code please refer below

option name="rangeColors">["0x65a637","0xf58f39","0xd93f3c"]option
option name="rangeValues">[1,2]/option>

View solution in original post

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Explorer

sorry Unable to do , can u pls provide full code :
my splunk code is :
index="index" | rex "(?:[^\t\n]\t){16}(?P[^\t])"|rex "(?:[^\t\n]\t){17}(?P[^\t])" | rex maxmatch=0 "(?[^\<\"]*)"|eval reasonsub_code=substr(reasoncode,1,7) | search runcode=Failure
| stats count

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Communicator

you should add this in dashboard XML go to edit source and add this this will not work as it is you need to adjust accordingly

0 Karma
Highlighted

Re: Stats to generate a single value background color AND font colour

Explorer

I've added into dashboard like below but no use

   <single>
    <title>Authentication</title>
    <search>


      <query>index="index"| rex "(?:[^\t\n]*\t){16}(?P&lt;runcode&gt;[^\t]*)"|rex "(?:[^\t\n]*\t){17}(?P&lt;reasoncode&gt;[^\t]*)" | rex max_match=0 "&lt;messageString&gt;(?&lt;reasoncode&gt;[^\\&lt;\"]*)"|eval reason_sub_code=substr(reasoncode,1,7) | stats count</query>



      <sampleRatio>1</sampleRatio>
    </search>
    <option name="drilldown">all</option>
 <option name="rangeColors">["0x65a637","0xf58f39","0xd93f3c"]</option>
 <option name="rangeValues">[1,2]</option>


  </single>
  <single>
0 Karma