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!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...