Splunk Search

Why am I unable to output from subsearch?

harryhcg
Explorer

I am having 2 index - abc - FieldA, E, F bcz - Field B, C, D. Where I want to return D, C and F where value from field E to match with B. I am getting the required output but not able to get F values.

This is my query:

index=abc fieldA="<>"
| rex field=_raw .......FieldB .... FieldC.. Field D
| search [ index=bcz FieldF="<>" | rename FieldE as FieldB | fields FieldB]
| stats count as Total by _time, FieldD, FieldC, FieldF | where FieldD="<>"

 

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your additional search command is just searching for matches in the initial search results, it does not introduce any new events to the result set. In order to do that, you either need to include both index in the initial search, or use append or use join.

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

According to your description, FieldF is in index abc not bcz.

0 Karma

harryhcg
Explorer

@ITWhisperer  Apologies for confusion, let me try to rephrase. 

Index=abc. FieldA, B, C, D
index=bcz. FieldE,F,G

I want to return _time, B, C, D, G where value from field E to match with B. I am getting the required output but not able to get G values.

This is my query:

index=abc
fieldA="<>"
| rex field=_raw .......FieldB .... FieldC.. Field D
| search [ search index=bcz FieldF="<>" | rename FieldE as FieldB | fields FieldB]
| stats count as Total by _time, FieldD, FieldC, FieldG | where FieldD="<>"

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your additional search command is just searching for matches in the initial search results, it does not introduce any new events to the result set. In order to do that, you either need to include both index in the initial search, or use append or use join.

harryhcg
Explorer

@ITWhisperer Query performance is not very good but getting result. 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...