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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...