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
SplunkTrust
SplunkTrust

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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...