Splunk Search

Can we pass main search result value into subsearch as search command?

avadhutha
Explorer

mainsearch| stats count(_raw)  as Cou by hour
|join hour [ subsearch| head -$Cou$ ]

 

Above mentioned command is not working, as main search values can be used as values in subsearch but unable to use it under a command. Any suggestions?

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

The question is not whether you can pass main search result value into subsearch, but what is it you are trying to perform.  There are many ways to implement anything in any general-purpose language such as SPL.  You already know the method proposed in the OP doesn't do what you wanted.  So, start by explaining your data, your logic, and your expected output. (This should be the general formula when posing a question.)

Starting from data and logic is even more important because join command is often the least efficient way to achieve anything.  Most of the time, join can be avoided.

0 Karma

avadhutha
Explorer

Thank you @yuanliu  for feedback. I have created a new conversation based on your suggestions.  

https://community.splunk.com/t5/Splunk-Search/how-to-get-90-of-max-execution-time/m-p/625167#M217321

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...