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
SplunkTrust
SplunkTrust

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

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...