Splunk Search

Making a drilldown search in a different timespan from its parent modules?

jwestberg
Splunk Employee
Splunk Employee

I have a search that searches in a time span set by a TimeRangePicker. I would like for the drilldown search that I produce to not take place in that same timespan, but rather over all time.

How can I accomplish this?

Tags (3)
0 Karma
1 Solution

sideview
SplunkTrust
SplunkTrust

Your view has to be written using the advanced XML, or converted to the advanced XML, but aside from that it's fairly simple.

In the advanced XML the nesting of module tags inside other module tags looks very confusing at first but this just encodes how modules get information from other modules.

So if a given module is inside a 'TimeRangePicker' module, it will inherit that TimeRangePicker's current time range. And if it's outside it wont know about it.
Furthermore for simple items like the base search string and the timerange, you can also clobber upstream changes by having another deeper module specify those keys again.

So making a change like this amounts to indenting some set of modules on the inside, and adding a new HiddenSearch module with a new timerange that replaces the one from higher up.

[[ the last of the modules you want to operate on the old timerange]]
<module name="HiddenSearch">
  <param name="earliest">-7d@d</param>
  <param name="latest">+1d@d</param>
  [[ (newly indented) all modules from here down will operate on the 'last 7 days' timerange]]                
</module>

The bad news is that it looks like there's no way to set it to All Time. This is more or less because the 'all time' timerange is really the absence of a timerange, and the params on HiddenSearch arent smart enough to know the difference between not wanting to set earliest/latest, and wanting to set it to an explicit null...

View solution in original post

sideview
SplunkTrust
SplunkTrust

Your view has to be written using the advanced XML, or converted to the advanced XML, but aside from that it's fairly simple.

In the advanced XML the nesting of module tags inside other module tags looks very confusing at first but this just encodes how modules get information from other modules.

So if a given module is inside a 'TimeRangePicker' module, it will inherit that TimeRangePicker's current time range. And if it's outside it wont know about it.
Furthermore for simple items like the base search string and the timerange, you can also clobber upstream changes by having another deeper module specify those keys again.

So making a change like this amounts to indenting some set of modules on the inside, and adding a new HiddenSearch module with a new timerange that replaces the one from higher up.

[[ the last of the modules you want to operate on the old timerange]]
<module name="HiddenSearch">
  <param name="earliest">-7d@d</param>
  <param name="latest">+1d@d</param>
  [[ (newly indented) all modules from here down will operate on the 'last 7 days' timerange]]                
</module>

The bad news is that it looks like there's no way to set it to All Time. This is more or less because the 'all time' timerange is really the absence of a timerange, and the params on HiddenSearch arent smart enough to know the difference between not wanting to set earliest/latest, and wanting to set it to an explicit null...

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 ...