How To Add The Time In Dashboard Panel Title
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.
At first create a dashboard. And then add a time range picker on that dashboard.
Then add a dropdown in the dashboard.
Then click on edit input to edit the dropdown.
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.
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.
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 !!