Splunk Search

Modify timespan of a subsearch

Oti47
Path Finder

Hi I’m trying to compare two days in my search, but not the whole day only e.g. from 00:00 till 13:30.

index="summary_dummy" earliest=@d | addinfo | stats sum(count) AS count1, max(search_now) as time1, min(info_min_time) as time2 | eval tspan=(time1-time2)/60 | eval tspan2=round(tspan)| append [search index="summary_dummy" earliest=-2@d  searchtimespanminutes=tspan| addinfo | stats sum(count) AS count2]

I tested tspan2 with isint() but still get the error “ tspan2 is not a valid value for searchtimespanminutes. It is not a positive integer.”
I think the Problem is that I didn’t pass tspan2 to my subsearch but I’ve no idea how to do that.

Tags (2)

sowings
Splunk Employee
Splunk Employee

You have it the other way around. A subsearch is evaluated before the outer search, because the results of the subsearch are passed to the outer search as a filter. I'd suggest that your search ... searchtimespanminutes=tspan ... be the outer search, with the search setting tspan be the subsearch.

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...