Create Custom Legend For Splunk Chart

Create Custom Legend For Splunk Chart

Today we will show the procedure to create a legend with a Splunk chart. By default, the legend is not available with Splunk pic chart visualization, radial gauge visualization. But as we all know that some time legends can be a very important part of a visualization to understand the depth of that data better.
So we will create a legend first for the “Radial gauge meter” visualization.
So here we have this dashboard named “Chart Legend”, where we have a “radial gauge meter” visualization. We will enable legend for this gauge meter.


Click on Edit  and Source


And do this below modifications in your source code as shown below,

<html>
   <div style="float: left;">
    <div style="background:#53a051;font-size: 13px;font-weight: bold;">0-500</div>
    <div style="background:#ffff33;font-size: 13px;font-weight: bold;">501-1000</div>
    <div style="background:#dc4e41;font-size: 13px;font-weight: bold;">1001-3000</div>
   </div>
   <div style="float: left;">
    <div style="color:#3c444d;font-weight: bolder;">Regular System Protocol</div>
    <div style="color:#3c444d;font-weight: bolder;">System Protocol on Queue</div>
    <div style="color:#3c444d;font-weight: bolder;">Abnormal System Protocol</div>
   </div>
  </html>

Based on your conditions you can change the above html code.
Then save the dashboard. And the final visualization with the legend will look awesome as shown below.


You can apply this legend on any Splunk chart like pie, bar, line, etc.

You can also know about :  Adding Time Input In Custom Date Time Field


To download the sample source code please click here.

Happy Splunking!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.