<?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 Re: Error in use of 'map' search command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95769#M24727</link>
    <description>&lt;P&gt;@gkanapathy,&lt;/P&gt;

&lt;P&gt;Good call on the quotes around $foo$.  Single quotes work as well. I also added maxsearches.  So that fixes the error I was getting.  Running the fixed syntax still yields me with the 3 results that the initial search produces.  Its as if the map command isn't being run at all.&lt;/P&gt;

&lt;P&gt;Right now I'm running this command against a single index, multiple sourcetypes (which differs from above, I'll update to reflect), on a single Splunk instance.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2010 02:04:21 GMT</pubDate>
    <dc:creator>kevintelford</dc:creator>
    <dc:date>2010-12-01T02:04:21Z</dc:date>
    <item>
      <title>Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95767#M24725</link>
      <description>&lt;P&gt;I have a sourcetype called sourcetype1 that contains the following three events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;foo=a
foo=b
foo=c
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I then have a sourcetype called sourcetype2 that contains the following 4 events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;bar=x, othervalue=4
bar=y, othervalue=3
bar=z, othervalue=2
bar=a, othervalue=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I do the simple search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=sourcetype1 | fields foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get back the expected 3 events: a, b, c.&lt;/P&gt;

&lt;P&gt;I then try to use the map command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=sourcetype1 | fields foo | map search="search index=myindex sourcetype=sourcetype2 bar=$foo$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and I get the error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[SimpleResultsTable module] Server reported HTTP status=400 while getting mode=results Error in 'map' command: Unable to run query 'search index=index2 bar=a'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which makes me sad.&lt;/P&gt;

&lt;P&gt;To further my confusion if I try a search just to get some different results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=sourcetype1 | fields foo | map search="search index=myindex sourcetype=sourcetype2 bar=x"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I end up the results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;a
b
c
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which acts as if the subsearch never occurred.  Any thoughts?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2010 04:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95767#M24725</guid>
      <dc:creator>kevintelford</dc:creator>
      <dc:date>2010-11-30T04:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95768#M24726</link>
      <description>&lt;P&gt;Is all the search and indexing on one Splunk instance, or do you have multiple indexers and/or a separate search head? Until 4.2, the &lt;CODE&gt;map&lt;/CODE&gt; command will not issue searches in distributed mode. Also, I believe that unless you specify otherwise, the &lt;CODE&gt;maxsearches&lt;/CODE&gt; option to the &lt;CODE&gt;map&lt;/CODE&gt; command defaults to 1, so you should set that higher.&lt;/P&gt;

&lt;P&gt;Also, I'm assuming you're replacing real terms with &lt;CODE&gt;foo&lt;/CODE&gt; and &lt;CODE&gt;bar&lt;/CODE&gt; and &lt;CODE&gt;a&lt;/CODE&gt; and &lt;CODE&gt;b&lt;/CODE&gt; etc., but the error you get is usually because the search you've constructed is syntactically invalid. Try perhaps putting quotes around the argument: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | map search="search index=index2 bar=\"$foo$\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Nov 2010 07:29:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95768#M24726</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-11-30T07:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95769#M24727</link>
      <description>&lt;P&gt;@gkanapathy,&lt;/P&gt;

&lt;P&gt;Good call on the quotes around $foo$.  Single quotes work as well. I also added maxsearches.  So that fixes the error I was getting.  Running the fixed syntax still yields me with the 3 results that the initial search produces.  Its as if the map command isn't being run at all.&lt;/P&gt;

&lt;P&gt;Right now I'm running this command against a single index, multiple sourcetypes (which differs from above, I'll update to reflect), on a single Splunk instance.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2010 02:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95769#M24727</guid>
      <dc:creator>kevintelford</dc:creator>
      <dc:date>2010-12-01T02:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95770#M24728</link>
      <description>&lt;P&gt;Yeah, ummm, I've never had much (okay, ANY) success with the map command.  I would recommend using the python API that Splunk ships with to automate this.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2010 12:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95770#M24728</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2010-12-01T12:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95771#M24729</link>
      <description>&lt;P&gt;I second the claim that this doesn't work. I only get the results from the original search, which is annoying as otherwise this would be a very useful command.&lt;/P&gt;

&lt;P&gt;The only time I have ever see this actually work as claimed is when invoking after a "| metadata" search, and then using map to iterate over hosts as suggested here: &lt;A href="http://answers.splunk.com/questions/8175/iterate-a-search-over-a-collection-of-variables"&gt;http://answers.splunk.com/questions/8175/iterate-a-search-over-a-collection-of-variables&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Are the results that come back from a metadata search different from normal events?&lt;/P&gt;

&lt;P&gt;I guess I will log a case about it.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2010 20:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95771#M24729</guid>
      <dc:creator>Glenn</dc:creator>
      <dc:date>2010-12-24T20:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95772#M24730</link>
      <description>&lt;P&gt;Map has been fixed for 4.2.4&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2011 22:11:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95772#M24730</guid>
      <dc:creator>carasso</dc:creator>
      <dc:date>2011-09-26T22:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error in use of 'map' search command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95773#M24731</link>
      <description>&lt;P&gt;Better late than clever &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2011 06:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-use-of-map-search-command/m-p/95773#M24731</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2011-09-27T06:36:37Z</dc:date>
    </item>
  </channel>
</rss>

