Spread our blog

Change Display Value In Mouse Hover

Today we are back with another interesting dashboard customization.
Without wasting the time let’s get the business directly. So we have a dashboard called “Demo dashboard”.


As you can see that in the mouse hover it’s showing all of his projected values for the line chart.
But we want to change those values in the hover with our desired values. With “log_level” it’s either zero ( 0) or 1, so instead of zero (0) we want to display “CONNECT” and instead of 1, we want to display “DISCONNECT”.
The query of the given dashboard panel.

index=_internal sourcetype=splunkd log_level!="INFO" host=”sh”
| eval log_level=if(log_level="ERROR",0,1) 
| table _time log_level

So let’s start,
First of all, we need to create a javascript for the requirement
Go to the $SPLUNK_HOME$\etc\apps\<appName>\appserver\static
And create the “displayOver.js


If you want to download the sample js file please click here.
Then restart the splunk server.

# sudo /opt/splunk/bin/splunk restart

Now go back to your dashboard.
Click on “Edit” and “Source


Then do these modifications as shown below,


Within the <dashboard> or <form> tag add script=”displayOver.js” and add the chart id as mentioned in the js within the <chart> tag.
And also need to do some little changes to populate the hover properly.


Now save the dashboard and see the magic.

Happy Splunking!!

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

Spread our blog

LEAVE A REPLY

Please enter your comment!
Please enter your name here