Splunk Search

Help with a nested search not returning any data

lamelendrez
Loves-to-Learn Lots

I am running a nested search but does not return any data.

However, when I run the search separately it does.

The full search with no results is:

index="f5-default" [search index="cisco_asa" host="192.168.5.x" dest_ip="172.16.5.57" 
| stats count by session_id src_ip | where count=2 | dedup src_ip | rename src_ip as IP | table IP]

But my first search:

index="cisco_asa" host="192.168.5.2" dest_ip="172.16.5.57" src_ip!="208.94.147.100" src_ip="40.77.167.108"

| stats count by session_id src_ip | where count=2 | dedup src_ip | rename src_ip as IP | table IP

or

index="f5-default" 

I get events.

0 Karma
1 Solution

woodcock
Esteemed Legend

Your search assumes that the field with the IPAddress in index="f5-default" is named IP which evidently it is not (otherwise it would DEFINITELY work). Fix the | rename src_ip AS IP to the correct field name.

View solution in original post

0 Karma

woodcock
Esteemed Legend

Your search assumes that the field with the IPAddress in index="f5-default" is named IP which evidently it is not (otherwise it would DEFINITELY work). Fix the | rename src_ip AS IP to the correct field name.

0 Karma

arjunpkishore5
Motivator

Does the index f5-default have a field named IP?

You could try getting your subsearch to return a plain text filter like this

index="f5-default" [search index="cisco_asa" host="192.168.5.x" dest_ip="172.16.5.57"
  | stats count by session_id src_ip 
  | where count=2 
  | dedup src_ip 
  | fields src_ip
  | rename src_ip as search]

Documentation here - https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/Search/Changetheformatofsubsearchresults

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Subsearches become literal text in their main searches. If the subsearch results in 3 IP addresses like 10.2.3.4, 10.3.4.5, 10.4.5.6 then the full search will be index="f5-default 10.2.3.4 10.3.4.5 10.4.5.6 which means all three IP addresses have to be present in an event to show up. Try this query:

index="f5-default" [search index="cisco_asa" host="192.168.5.x" dest_ip="172.16.5.57"
| stats count by session_id src_ip | where count=2 | dedup src_ip | rename src_ip as IP | fields IP | format]

The format command adds OR operators between the results so you get a final search that looks like index="f5-default (IP=10.2.3.4 OR IP=10.3.4.5 OR IP=10.4.5.6), which should work better.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...