Splunk Search

Map command maxsearches unexpected behavior

gkapitany
Explorer

I have the search below:

index=stats_summary dest_ip=172.* 
| dedup src_ip dest_ip|  map maxsearches=100 search="| inputlookup networks.csv
| eval dip=$dest_ip$
| eval sip=$src_ip$
| eval dm=if(cidrmatch(cidr,$dest_ip$),1,0) 
| where  dm == 1 
| table * "
| table sip dip

The first search returns about 20K records. The lookup table has about 90 records. If I set the maxsearches to 100 then the search returns zero records. If I set maxsearches to 3500 then I get about 100+. According to the documentation, maxsearches controls how many times the map search iterates over each record from the first search. Any ideas on what I'm doing wrong?

0 Karma
1 Solution

gkapitany
Explorer

I found and alternate solution based on another post. I had to update the transforms.conf file with:

[networks]
default_match = NONE
match_type = CIDR(cidrBlock)
check_permission = true
filename = networks.csv

The query below returns the results I was trying to get with map search:

index=stats_summary dest_ip=172.*
| dedup src_ip dest_ip
| lookup networks cidrBlock as dest_ip OUTPUT cidrBlock as dmatch
| where dmatch != "NONE"
| table src_ip dest_ip

View solution in original post

gkapitany
Explorer

I found and alternate solution based on another post. I had to update the transforms.conf file with:

[networks]
default_match = NONE
match_type = CIDR(cidrBlock)
check_permission = true
filename = networks.csv

The query below returns the results I was trying to get with map search:

index=stats_summary dest_ip=172.*
| dedup src_ip dest_ip
| lookup networks cidrBlock as dest_ip OUTPUT cidrBlock as dmatch
| where dmatch != "NONE"
| table src_ip dest_ip

richgalloway
SplunkTrust
SplunkTrust

@gkapitany If your problem is resolved, please accept the answer to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

maxsearches does not mean "max results". It's the number of times the map command will run regardless of whether anything is found.
What are you trying to do? Perhaps we can suggest another method.

---
If this reply helps you, Karma would be appreciated.
0 Karma

gkapitany
Explorer

I'm trying to get all src_ip for which the dest_ip in in one of the network ranges listed in network.csv. The lookup table consist of about 90 cidr ranges.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...