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!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...