Splunk Search

Subsearch didn't work with starttimeu passed by variable of main search

ejpulsar
Path Finder

Hi, I'm trying to calculate daily time shift baseline by this query

source="MySource" | eval ReportKey="Today" |
eval d1AgoEarliest=relative_time(_time,"-1d@d")|
eval d1AgoLatest=relative_time(_time,"-0d@d")|
append [search source="MySource" starttimeu=d1AgoEarliest endtimeu=d1AgoLatest]

It retuns error
d1AgoEarliest is not a valid value for starttimeu. It is not a positive floating point number.

Tags (1)
0 Karma

kristian_kolb
Ultra Champion
0 Karma

Ayn
Legend

That's because you can't pass variables from outer searches to subsearches. Subsearches run before the outer searches, so they can't receive values from the search because it hasn't run yet.

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