Dashboards & Visualizations

Status codes color on Pie chart

Isaias_Garcia
Path Finder

Hi-

I have a pie chart in my dashboard and I want to put specific color for a specific webservers status codes (202, 404, 502, etc).I tried the below xml parameters but the color is still randomly changing. This is the input that I want for 200 = green, 302=blue , 301 = blue , 404 = yellow and 502 = red. I also tried several suggestions found on this Splunk answers forum but to no avail.Please advise.

searchString>sourcetyphart>
            <searchString>sourcetype="access_combined_wcookie" host=*crdd* uri=/mpd* | stats count by status</searchString>
      <title>Status Code Summary (All Web Requests) - Last 60 min</title>
      <earliestTime>-60m</earliestTime>
      <latestTime>@m</latestTime>
      <option name="charting.chart">pie</option>
      <option name="count">50</option>
      <option name="displayRowNumbers">true</option>
     <option name="charting.chart.rangeValues">[202,502,302,404]</option>
     <option name="charting.seriesColors">[0xbf3030,0x84e900,0x84e900,0xffe800]</option>
     <option name="charting.chart.sliceCollapsingThreshold">0</option>
     </chart>
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

You can define colors per field value like this:

<dashboard>
<row>
<chart>
<searchString>index=_internal source=*access* | chart count by status</searchString>
<earliestTime>-60m@m</earliestTime>
<latestTime>now</latestTime>
<option name="charting.chart">pie</option>
<option name="charting.fieldColors">{200:0x00ff00,201:0x33ff00,204:0x66ff00,303:0xffaa00,304:0xffff00,404:0xff0000}</option>
</chart>
</row>
</dashboard>

View solution in original post

0 Karma

the_wolverine
Champion

This worked for me - I had to enclose the field value in double quotes:

  <option name="charting.fieldColors">{"404": 0xFF0000, "200": 0x84E900}</option>

external_alien_
Explorer

the_wolverine has the best answer. This assigns a specific color for a specific value. For anyone with the same problem as me that if you have for example "low", "medium", "high" values and you want to color them in green, yellow, red then this will assign the correct color every time! All other answers will color medium as green if there are no low value for example! 😃

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You can define colors per field value like this:

<dashboard>
<row>
<chart>
<searchString>index=_internal source=*access* | chart count by status</searchString>
<earliestTime>-60m@m</earliestTime>
<latestTime>now</latestTime>
<option name="charting.chart">pie</option>
<option name="charting.fieldColors">{200:0x00ff00,201:0x33ff00,204:0x66ff00,303:0xffaa00,304:0xffff00,404:0xff0000}</option>
</chart>
</row>
</dashboard>

0 Karma

Isaias_Garcia
Path Finder

That's the one I used.

0 Karma

MuS
Legend

Is that XML code the one you use or did you made a copy/paste error?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...