Splunk Search

Can't return subsearch results

souhei
Explorer

Hello, splunk community.

I tried to exec subsearch command for adding search condition of "main" search.
Datas of target of subsearch have single field named nameOfFruit.
example below,

apple
orange
pineapple
... and so on

I wrote search command like this,

 index=main [search index=sub | return nameOfFruit]

but it didn't work yet.

How should i write?
or can't i do this?

note:

Of course, before i ask this question, I found related articles below.
but any answer of these question didn't work well.

[How to return raw data results from subsearch query?]
http://answers.splunk.com/answers/172644/how-to-return-raw-data-results-from-subsearch-quer.html

[Appending search results with subsearch fields.]
http://answers.splunk.com/answers/170474/appending-search-results-with-subsearch-fields.html

[Filter search results based on return value of subsearch]
http://answers.splunk.com/answers/89845/filter-search-results-based-on-return-value-of-subsearch.htm...

[return command - exit (or return known value) if no results found]
http://answers.splunk.com/answers/89951/return-command-exit-or-return-known-value-if-no-results-foun...

1 Solution

kml_uvce
Builder

try this
index=main [search index=sub | table nameOfFruit]

View solution in original post

0 Karma

souhei
Explorer

Hi kml_uvce.

Thanks in advance for your reply.

I tried the command suggested in your answer.
but, it didn't work.

I confirmed the command below worked well.

index=sub | table nameOfFruit

However, the commands below didn't work well...
#empty result was returned.

index=main [search index=sub | table nameOfFruit]
[search index=sub | table nameOfFruit]
0 Karma

souhei
Explorer

Thank you for your comment.

I tried your suggestion, then the command seemed to work well.
so... I might bark on the wrong tree.

Actually, This problem is just that result of main search command(including search condition of "sub" search result) return empty.

I'm sorry for trouble you.

0 Karma

MuS
Legend

Check the Job inspector where or why this fails

0 Karma

kml_uvce
Builder

try this
index=main [search index=sub | table nameOfFruit]

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...