Spread our blog

Hi Guys !!

We have posted many blogs on Dashboard customization in Splunk and the category of adding colours different ways in dashboard is one of them.

So, today also we have come with another colourful topic.

How to add different background colours to different panel titles in Splunk dashboard.

So, let’s start.

Step 1:

We have created one dashboard named Sample Dashboard, which looks like below image.

Explanation:

Here, in this dashboard, we have two panels named “Method Count” and “Status Count”.

The query of “Method Count” panel is mentioned below,

index=_internal sourcetype=splunkd_ui_access | stats count(method) as method_count

Here, we have used “_internal” index and “splunkd_ui_access” sourcetype. Then we have used “stats” command to get count of “method” field’s value in method_count field. The visualization is Single Value.

The query of “Status Count” panel is mentioned below,

index=_internal sourcetype=splunkd_ui_access | stats count(status) as status_count

Here, we have used “_internal” index and “splunkd_ui_access” sourcetype. Then we have used “stats” command to get count of “status” field’s value in status_count field. The visualization is Single Value.

NOTE:

You can use any query and any visualization. Before moving forward, let us explain one thing.

Each panel in Splunk Dashboard has two headers h2 and h3.

Here, for the 1st panel “Method Count” is h2 and “Method Count for Last 15 minutes” is h3 and for the 2nd panel “Status Count” is h2 and “Status Count for Last 15 minutes” is h3. Here, we will show you adding background colour to h2 header.

NOTE:

The process of adding background colour to h2 and h3 is almost same. We will explain the difference also.

You can also know about :  How to Change the Background Color of a Chart in Splunk

Step 2:

Now, click on the “Edit” option.

Step 3:

Now, click on the “Source” option to edit the source code.

Step 4:

Now, we will make some changes in the source code.

Explanation:

We have added the below html code for the 1st panel “Method Count”.

    <html>
        <style>
          #panel_one .dashboard-panel h2{
            background:#0000FF;
            color:white;
            font-weight:bold;}
        </style>
        </html>

Here, we have added “style” tag inside “html” tag. Inside style tag, we have added first the id “panel_one”, the same id needs to be used in panel tag as panel id, like we did [As, you can see in the above image].

Also, there we have mentioned .dashboard-panel h2, where “dashboard-panel” is the class name and h2 refers that we want to use this html tag for h2 header.

Then we have added the background:#0000FF to change the background colour of Blue [ “#0000FF” is html code of Blue colour, you can add any colour’s in html code.]

Then to change the font colour to white we have used color:white [You can add any colour].

Now, to change the font format to bold we did, font-weight:bold.

Explanation:

We have added the below html code for the 2nd panel “Status Count”.

    <html>
        <style>
          #panel_two .dashboard-panel h2{
            background:#008000;
            color:white;
            font-weight: bold;}
        </style>
        </html>

Explanation:

The html code is same as the 1st html code, we have added for “Method Count” panel except the id and the background colour we have used.

Here, we are using “panel_two” as and we have used different background colour “#008000” (“#008000” is the html code of Green colour).

You can also know about :  Splunk Drilldown Tokens: $click.value$ (Part-II)

NOTE:

Like we said adding background colour to h2 and h3 is almost same. So, instead of h2 if you want to add background colour to h3, then just in the html code mention h3 instead of h2 in the 1st line of style tag.

Step 5:

As, you can see in the below image, the background colour of title of 1st panel “Method Count” is changed to Blue and the background colour of title of 2nd panel “Status Count” is changed to Green.

Hope you have enjoyed this blog, we will come back with new topics of Splunk. Until then goodbye and stay safe and strong.

Happy Splunking !!

What’s your Reaction?
+1
+1
+1
+1
+1
2
+1
1
+1

Spread our blog

LEAVE A REPLY

Please enter your comment!
Please enter your name here