All Apps and Add-ons
Highlighted

Sideview Utils Redirector - Time Range

Communicator

I have one doubt regarding redirector.
How can we pass the time range.Suppose i want when user click on any row,detailed event should get displayed in flashtimeline.But i am not able to pass time range.
Is this possible?

Tags (1)
Highlighted

Re: Sideview Utils Redirector - Time Range

Champion

I think the fields you can use are $search.timeRange.earliest$ or $search.timeRange.latest$, these will pull the timeranges out for you to pass through.

0 Karma
Highlighted

Re: Sideview Utils Redirector - Time Range

Communicator

Thanks.So i need to pass this in query.Is there any way to directly pass it to the timerange picker of flashtimeline.

0 Karma
Highlighted

Re: Sideview Utils Redirector - Time Range

SplunkTrust
SplunkTrust

To get the timerange into the URL as ?earliest=-24h&latest=now what you do is add these params to the Redirector module:

 <param name="arg.earliest">$search.timeRange.earliest$</param>
 <param name="arg.latest">$search.timeRange.latest$</param>

and that's it. If you're linking to a Sideview view that's using the Sideview URLLoader module, it's a little easier in that you just make sure the arguments you're sending match the "name" params of the relevant UI modules, and you send an "arg.autoRun" value of "True" if the target view does not already have an autoRun="True".

If you're redirecting to a core Splunk view like flashtimeline, then you have to form the big "q" argument which is just a single big search string. Fortunately the way you pass the earliest and latest args is the same for both flavors of views. Just pass earliest and latest as the params as you see above.

View solution in original post

Highlighted

Re: Sideview Utils Redirector - Time Range

Path Finder

Is it possible to modify the time when using the redirector? I would like to affect a kind of "time zoom". The big picture spans a week of events, but I'd like to click on an event then get the details for that one day. In my case $click.value$ is the time. How can I set the earliest and latest search params to be one day based on the day of the $click.value$? thanks!!

0 Karma
Highlighted

Re: Sideview Utils Redirector - Time Range

SplunkTrust
SplunkTrust

Yes - it's possible. But it's strange.

You want to hijack PostProcess to quickly calculate what the "zoomed" times are, as epochtime values (ie the number of seconds since 1/1/1970). Then we use ResultsValueSetter to pull those two integers down to the UI as $foo$ tokens. Then we can use them in our Redirector.

I'm assuming here that the "event" you're clicking on is actually a Table module, so that Table is the first module in the example snippet below.

<module name="Table">
  <module name="PostProcess">
    <param name="search">| stats count | fields - count | eval earliest=1477168511 | eval midnight=relative_time(earliest,"@d")  | eval next_midnight=relative_time(earliest,"@d+d")</param>
    <module name="ResultsValueSetter">
      <param name="fields">midnight,next_midnight</param>
      <module name="Redirector">
        <param name="url">YOUR_VIEW_NAME_HERE</param>
        <param name="earliest">$midnight$</param>
        <param name="latest">$next_midnight$</param>
      </module>
    </module>
  </module>
</module>

Other sort of "partial credit" idea is to use the almost-entirely-forgotten search modifier "searchtimespandays=1", which dates back to 2.0 and 3.0 but which is still in the product. However there's no way that I can think of to calculate the earliest side argument without the postprocess hack. (and unfortunately Splunk does not support expressions like earliest=1477168511@d)

0 Karma