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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...