Splunk Search

How to input a single epoch time from a dashboard URL as a time range inside the time picker

pkol
Explorer

Hey gang,
I have an external system which can call a dashboard URL - but it can only supply a single epoch time
How do I use a dashboard to turn that time into a time range?

I tried making a new "text input" and use the "text input's" token in the URL to input the epoch time,
then I used a tag inside the "text input" to update my time picker by adding and subtracting 15 mins to the supplied epoch time. The problem with this approach is that the time picker dosent update as soon as the URL loads since my manipulation is done inside a change tag.
Can anyone help me out please?
Thank you.
Here's my XML:

 <input type="time" token="time_pick" searchWhenChanged="true">
      <label>Time range</label>
      <default>
        <earliest>-20m@m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="text" token="trigger_time">
      <label>trigger_time_test</label>
      <change>
        <eval token="time_pick.earliest">$trigger_time$ - 900</eval>
        <eval token="time_pick.latest">$trigger_time$ + 900</eval>
      </change>
    </input>

to4kawa
Ultra Champion
<form>
  <label>Search by input text of epoch time</label>
  <fieldset submitButton="false">
    <input type="text" token="time" searchWhenChanged="true">
      <label>epoch time</label>
      <change>
        <eval token="time_pick.earliest">$time$ - 900</eval>
        <eval token="time_pick.latest">$time$ + 900</eval>
      </change>
      <default></default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults
| eval min_time=$time_pick.earliest$, max_time=$time_pick.latest$
| table *</query>
          <earliest>$time_pick.earliest$</earliest>
          <latest>$time_pick.latest$</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">10</option>
        <option name="drilldown">cell</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <link target="_blank">/app/search/search?earliest=$time_pick.earliest$&amp;latest=$time_pick.latest$&amp;q=%7C%20makeresults&amp;display.page.search.mode=smart&amp;dispatch.sample_ratio=1&amp;workload_pool=&amp;display.general.type=statistics&amp;display.page.search.tab=statistics</link>
        </drilldown>
      </table>
    </panel>
  </row>
</form>

This is an example.
It may be a little different, but the search period is set from the time of the text box.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...