<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Map command maxsearches unexpected behavior in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497718#M138608</link>
    <description>&lt;P&gt;I have the search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;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
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;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? &lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2019 14:38:56 GMT</pubDate>
    <dc:creator>gkapitany</dc:creator>
    <dc:date>2019-10-03T14:38:56Z</dc:date>
    <item>
      <title>Map command maxsearches unexpected behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497718#M138608</link>
      <description>&lt;P&gt;I have the search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;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
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;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? &lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 14:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497718#M138608</guid>
      <dc:creator>gkapitany</dc:creator>
      <dc:date>2019-10-03T14:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Map command maxsearches unexpected behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497719#M138609</link>
      <description>&lt;P&gt;maxsearches does not mean "max results".  It's the number of times the &lt;CODE&gt;map&lt;/CODE&gt; command will run regardless of whether anything is found.&lt;BR /&gt;
What are you trying to do?  Perhaps we can suggest another method.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 17:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497719#M138609</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-03T17:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Map command maxsearches unexpected behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497720#M138610</link>
      <description>&lt;P&gt;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.  &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:28:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497720#M138610</guid>
      <dc:creator>gkapitany</dc:creator>
      <dc:date>2020-09-30T02:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Map command maxsearches unexpected behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497721#M138611</link>
      <description>&lt;P&gt;I found and alternate solution based on another post. I had to update the transforms.conf file with:&lt;/P&gt;

&lt;P&gt;[networks]&lt;BR /&gt;
default_match = NONE&lt;BR /&gt;
match_type = CIDR(cidrBlock)&lt;BR /&gt;
check_permission = true&lt;BR /&gt;
filename = networks.csv&lt;/P&gt;

&lt;P&gt;The query below returns the results I was trying to get with map search:&lt;/P&gt;

&lt;P&gt;index=stats_summary  dest_ip=172.* &lt;BR /&gt;
| dedup src_ip dest_ip &lt;BR /&gt;
| lookup networks cidrBlock as dest_ip OUTPUT cidrBlock as dmatch &lt;BR /&gt;
| where dmatch != "NONE" &lt;BR /&gt;
| table src_ip dest_ip&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497721#M138611</guid>
      <dc:creator>gkapitany</dc:creator>
      <dc:date>2020-09-30T02:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Map command maxsearches unexpected behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497722#M138612</link>
      <description>&lt;P&gt;@gkapitany If your problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 19:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-command-maxsearches-unexpected-behavior/m-p/497722#M138612</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-03T19:54:59Z</dc:date>
    </item>
  </channel>
</rss>

