Splunk Search

Can not get my subsearch work

oshirnin
Path Finder

Hello, everybody!

Does anybody can help me understand why the following subsearch not limits the results of the outer search to events from only one host?

index=_internal [search index=_internal | top limit=1 host | table host]

This is a test query, of course I have more meaningful subsearch and outer searches, my goal is to get a set of hosts from the subsearch and then query events from only these hosts in the outer search. Obviously the subsearch ends up with

( ( host="TheHostName" ) )

but I still get events from 100+ hosts from the outer search. Looks very strange to me.

0 Karma
1 Solution

oshirnin
Path Finder

I ended up with upgrading to 7.3.5 (most current 7.x release). It seems I caught the bug with my 7.3.2 https://answers.splunk.com/answers/781748/major-bugs-in-searches-in-splunk-73-do-not-upgrade.html

Actually the problem gone after I upgraded SH cluster members, not even search peers.

View solution in original post

0 Karma

oshirnin
Path Finder

I ended up with upgrading to 7.3.5 (most current 7.x release). It seems I caught the bug with my 7.3.2 https://answers.splunk.com/answers/781748/major-bugs-in-searches-in-splunk-73-do-not-upgrade.html

Actually the problem gone after I upgraded SH cluster members, not even search peers.

0 Karma

masonmorales
Influencer

I tested your query and it correctly limits the results to 1 host for me. If you look at job inspector, does the query look correct? I'm thinking maybe there is a search filter on your role that is getting applied and skewing the results.

oshirnin
Path Finder

Hello, @masonmorales I checked the job inspector and see the following: subsearch returns 2 hosts, but the outer search still doesn't filter on these. Actually I expected normalizedSearch to be something like index=_internal (host="m...62" OR host="m...03"))

I run on Splunk 7.3.2

search
remoteSearch
normalizedSearch
hosts

0 Karma

oshirnin
Path Finder

I have just tested the same query on the another Splunk instance which is 7.1.2 an it runs as expected, subsearch filters the outer search results. The remoteSearch on this instance looks like index=_internal (host="host1" OR host="host2" OR host="host3"). I wonder what may be wrong with my first instance, I'm Splunk admin built-in role on both instances...

0 Karma

to4kawa
Ultra Champion

well, when there is more than one SH or idx, this will be happen, I guess.
I'll learn a lot.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...