Splunk Enterprise

Why is the background color is for my single value visualization not as expected?

x05311
Explorer

Expected background color is light blue but its showing with BLACK color.

0 Karma
1 Solution

adonio
Ultra Champion

The range assumes you have a numeric value, the eval statement converts your numeric value to a string and splunk falls on default (black)
new code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

screenshot:

alt text

View solution in original post

adonio
Ultra Champion

The range assumes you have a numeric value, the eval statement converts your numeric value to a string and splunk falls on default (black)
new code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

screenshot:

alt text

x05311
Explorer

Thank you Sir,
Thank you Sir,
Thank you Sir,

0 Karma

adonio
Ultra Champion

you are welcome!!!

0 Karma

adonio
Ultra Champion

hello there, looks like you dont have the range defined:
here is a sample code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

and some screenshots:
alt text

alt text

0 Karma

x05311
Explorer

Still it is showing Black color, in your code your are populating only count.

count

 <panel>
   <title>count 100</title>
   <single>
     <search>
       <query>index = _internal | head 100 | stats count AS cnt | eval per= (cnt+1)/9 | eval Percent =ROUND(per,2)."%"| table Percent</query>
       <earliest>-15m</earliest>
       <latest>now</latest>
       <sampleRatio>1</sampleRatio>
     </search>
     <option name="colorMode">block</option>
     <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
     <option name="rangeValues">[0,100]</option>
     <option name="useColors">1</option>
   </single>
 </panel>
0 Karma

adonio
Ultra Champion

you can use these function in the gui editor to keep tour value numeric and not convert it to string by adding the percent symbol
click number format on the editor and add the precision you want and the unit you would like before and after.
adding code and screenshot in the next answer

0 Karma

x05311
Explorer
<panel>
  <single>
     <search>
      <query>index=index|eval conversion=((AAA_Error/Total_user)*100)|eval Percent =ROUND(conversion,2)."%"| table Percent</query>
      <earliest>0</earliest>
      <sampleRatio>1</sampleRatio>
    </search>
    <option name="colorMode">block</option>
    <option name="drilldown">none</option>
    <option name="rangeColors">["0x98AFC7","0x98AFC7","0x98AFC7"]</option>
    <option name="rangeValues">[0]</option>
    <option name="useColors">1</option>
  </single>
</panel>
0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...