Splunk Search

How do you perform a sub search over indexes?

Marinus
Communicator

I've recently split up my data into indexes and some of my searches that make use of sub searches are now breaking.

For example I previously did a

tag::host=esb* [search TestService | fields + transaction_id] | transaction transaction_id

To cater for the index change I did

index=test tag::host=esb* [search TestService | fields + transaction_id] | transaction transaction_id

No luck, I even stuck an index into the subsearch with no results.

What is the correct syntax?

Marinus

Tags (2)
1 Solution

Marinus
Communicator

I found a workaround. I'm using the internal index as an example.

index=_internal [search index=_internal | head 1000 | fields + user] | transaction user

View solution in original post

0 Karma

Marinus
Communicator

I found a workaround. I'm using the internal index as an example.

index=_internal [search index=_internal | head 1000 | fields + user] | transaction user
0 Karma

Ayn
Legend

I assume you want the subsearch to go against the test index as well. The subsearch runs on its own and returns its results to the outer search, so any search parameters you add to the outer search do not affect the subsearch. Add index=test in the subsearch instead and have it return what index it's operating on to the outer search so that it uses the same index. Llike this:

tag::host=esb* [search index=test TestService | fields transaction_id,index] | transaction transaction_id
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...