Dashboards & Visualizations

How to add Search time range in table title

JIthesh_Kumar
Explorer

How can i add my search time range in my table title? 

Code: 

<title>Search from &lt;$SelectTime.earliest$&gt; to &lt;$SelectTime.latest$&gt;</title>

OutPut:

Search from <1691971200> to <1692057600>

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try adding something like this to your SelectTime input.

<change>
  <eval token="fromTime">strftime($SelectTime.earliest$,"%F %T")</eval>
  <eval token="toTime">strftime($SelectTime.latest$,"%F %T")</eval>
</change>

You then have two new tokens to use in your title.

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

These are times, they are just in internal format i.e. number of seconds since 1/1/1970.

You probably want to create tokens in the change handler of the time picker which evaluate tokens using the strftime() function.

0 Karma

JIthesh_Kumar
Explorer

How can i do that 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try adding something like this to your SelectTime input.

<change>
  <eval token="fromTime">strftime($SelectTime.earliest$,"%F %T")</eval>
  <eval token="toTime">strftime($SelectTime.latest$,"%F %T")</eval>
</change>

You then have two new tokens to use in your title.

JIthesh_Kumar
Explorer

Thanks for the replay , 

 

<done>
<eval token="earliest_time">strftime(relative_time(now(), $SelectTime.earliest$), "%d %b %T")</eval>
<eval token="latest_time">strftime(relative_time(now(), $SelectTime.latest$), "%d %b %T")</eval>
</done>

 

Now how can i convert it to GMT time 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Here's how you might do it in SPL

| eval time=strftime(_time,"%F %T %:::z")
| eval offset = substr(time,21,23)
| eval time_args = if( -1 * offset >= 0, "+".substr(offset,2,3), printf("%03d",-1 * offset))
| eval GMT = ceil(relative_time(_time,time_args."h"))
| convert ctime(GMT)

You might be able to get this to work with multiple eval token lines.

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...