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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...