Dashboards & Visualizations

In my dashboard, how to set the default latest time based on earliest time from a URL?

exmuzzy
Explorer

I have time input in my dashboard:

<input type="time" token="trxTime">
 </input>

If I open dashboard with URL ...&form.trxTime.earliest=1488056400 then I get earliest=1488056400 and latest=now

How can I automatically set latest=earliest + 2d
without using URL ...&form.trxTime.latest=XXX

Something like that:

    <input type="time" token="trxTime">
      <default>
        <latest>$trxTime$ + 2d</latest>
      </default>
    </input>
0 Karma

lguinn2
Legend

I believe that you need to use a token to calculate the value that you need. Here is a link to Token usage in dashboards, which has a lot of reference information. If trxTime is in Linux epoch time (which appears to be true), you can calculate a new token $latestTime$

<eval token="latestTime">relative_time($trxTime$,"+2d")</eval>

You may want to use something like this in combination with the tokens described in the subsection "Define tokens for time inputs" on the same page. Hopefully, this section will get you started.

0 Karma

exmuzzy
Explorer

Thanks!

How to use this new token in default timer-picker?
Something like this?

<eval token="latestTime">relative_time($trxTime$,"+2d")</eval>
<input type="time" token="trxTime">
       <default>
         <latest>$latestTime$</latest>
       </default>
     </input>
0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@exmuzzy - Did lguinn's answer help provide a solution to your original question? If yes, please don't forget to resolve this post by clicking "Accept". Thanks!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...