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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...