Spread our blog

How To Add The Time In Dashboard Panel Title

Hello everyone!!
Today we have come with a new and interesting trick of Splunk. We often select time on the dashboard to see the data for the particular time period. But if you what to see the time range you selected in human readable format what will you do ?
That’s why we are here today to show you that how you can show the time range selected in human readable format in the Panel Title.

Step 1:
At first create a dashboard. And then add a time range picker on that dashboard.

 

Step 2:
Then add a dropdown in the dashboard.

Step 3:
Then click on edit input to edit the dropdown.

Step 4:
We have give the label as “title” also set the token called “title”.


Then in the dynamic option we have written a search to populate the dropdown option. This query is the main logic behind our whole trick.

| gentimes start=-1
| addinfo
| eval title="between '".strftime(info_min_time,"%F %T")."' and '".strftime(info_max_time,"%F %T")."'".

Using eval command we have populated a field called “title”. Also we set that field as Field For Label and Field For Value. Then click on apply to save the changes.

Step 5:
We have to do some more in source code. Click on the Source option to open the source code of the dashboard.


We used depends=”$anything$” to hide the dropdown option. Also we have used <selectFirstChoice>true</selectFirstChoice> to set the first row value as the default value of the dropdown option.

You can also know about :  How to Add Custom Emoji in Splunk Dashboard


We have passed the token on the panel title also. And then save it to save the changes.


Now you can see whatever the time range we are selecting from the time range picker we are getting that value in human readable format in the panel title.


Hope you can now  implement it by yourself  to meet you daily requirements.

Happy Splunking !!

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

Spread our blog

2 COMMENTS

  1. This is a very good approach. But it only works for me when the dropdown with the timerange has also a start- and an endtime.

    $timerange.earliest$
    $timerange.latest$

    timerange is the token from the timepicker

    title
    true
    title
    title

    | gentimes start=-1
    | addinfo
    | eval title=”zwischen ‘”.strftime(info_min_time,”%F %T”).”‘ und ‘”.strftime(info_max_time,”%F %T”).”‘”
    $timerange.earliest$
    $timerange.latest$

LEAVE A REPLY

Please enter your comment!
Please enter your name here