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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...