Splunk Search

subsearch from previous results

bijodev1
Communicator

I need to run three different queries based on the each respective results. 

for example :

1) In the first one query : index * search | top result. 

so let's say I pick the first result which is "abc"

2) In second query I use the first result and inject it in here

index=* search result=abc | top status

3) Use the second result and inject it in the third search

index=* search result=abc status=xyz | timechart count by "something"

 

I am not sure if there is easier way to do it or this would take more time and bandwidth. Any help would be really helpful. Need some guidance here.

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Subsearches are execute first so try nesting the searches like this

index=* 
    [ search index=*
        [ search index=* 
        | top result
        | head 1
        | table result ]
    | top status result
    | head 1
    | table status result ]
| timechart count by "something"index=* 

View solution in original post

bijodev1
Communicator

thank you @ITWhisperer  it worked as expected.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Subsearches are execute first so try nesting the searches like this

index=* 
    [ search index=*
        [ search index=* 
        | top result
        | head 1
        | table result ]
    | top status result
    | head 1
    | table status result ]
| timechart count by "something"index=* 
Get Updates on the Splunk Community!

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...

[Live Demo] Watch SOC transformation in action with the reimagined Splunk Enterprise ...

Overwhelmed SOC? Splunk ES Has Your Back Tool sprawl, alert fatigue, and endless context switching are making ...

What’s New & Next in Splunk SOAR

Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us on ...