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
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

  Ready to master Kubernetes and cloud monitoring like the pros?Join Splunk’s Growth Engineering team for an ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...