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>
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>
This worked for me - I had to enclose the field value in double quotes:
<option name="charting.fieldColors">{"404": 0xFF0000, "200": 0x84E900}</option>
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! 😃
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>
That's the one I used.
Is that XML code the one you use or did you made a copy/paste error?