<?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: Problem with map command - Using search from lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440019#M125141</link>
    <description>&lt;P&gt;already tried it, and got the same result. &lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 14:12:01 GMT</pubDate>
    <dc:creator>astatrial</dc:creator>
    <dc:date>2019-05-06T14:12:01Z</dc:date>
    <item>
      <title>Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440017#M125139</link>
      <description>&lt;P&gt;Hi all, &lt;BR /&gt;
I am trying to run a map command that will run searches from a lookup one by one as follows : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup "Correlation_searches.csv" 
| head 1
| map search="$check_search$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The head 1 is just for debug purpose. The value of $check_search$ is the search.&lt;/P&gt;

&lt;P&gt;For some reason i get the next error : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Unable to run query '"| tstats `summariesonly` count from 
datamodel=\"Change_Analysis.All_Changes\" where earliest=-7d@h latest=now 
nodename=\"All_Changes.Account_Management\" \"All_Changes.tag\"=\"delete\""'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But i ran this search and it worked just fine: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 1 
| map search="| tstats `summariesonly` count from datamodel=\"Change_Analysis.All_Changes\" 
where earliest=-7d@h latest=now nodename=\"All_Changes.Account_Management\" 
\"All_Changes.tag\"=\"delete\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 14:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440017#M125139</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-06T14:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440018#M125140</link>
      <description>&lt;P&gt;@astarial - Try removing the quotes. &lt;CODE&gt;map search=$check_search$&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 14:05:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440018#M125140</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-05-06T14:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440019#M125141</link>
      <description>&lt;P&gt;already tried it, and got the same result. &lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 14:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440019#M125141</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-06T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440020#M125142</link>
      <description>&lt;P&gt;Does your lookup table field check_search has all the quotes/special character escaped? Would you mind pasing result of &lt;CODE&gt;| inputlookup "Correlation_searches.csv"  | head 1&lt;/CODE&gt; here. Do remember to format the result using &lt;CODE&gt;101010&lt;/CODE&gt; button in the editor here OR press Ctrl+K after selecting it. Also, scrub any sensitive data that you may have.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440020#M125142</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-30T00:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440021#M125143</link>
      <description>&lt;P&gt;The output of this command is : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;check_search        
| tstats `summariesonly` count from datamodel="Change_Analysis.All_Changes" where earliest=-7d@h latest=now  nodename="All_Changes.Account_Management" "All_Changes.tag"="delete"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is just a version of a built in correlation search, so there is nothing sensitive here.  The check_search is the name of the column&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 07:00:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440021#M125143</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-07T07:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440022#M125144</link>
      <description>&lt;P&gt;It is not obvious but if you look closely, you will see that there are &lt;CODE&gt;double-quote&lt;/CODE&gt; characters getting in the way.  The search that is getting run is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"| tstats `summariesonly` count from 
datamodel=\"Change_Analysis.All_Changes\" where earliest=-7d@h latest=now 
nodename=\"All_Changes.Account_Management\" \"All_Changes.tag\"=\"delete\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead of your desire of this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` count from 
datamodel="Change_Analysis.All_Changes" where earliest=-7d@h latest=now 
nodename="All_Changes.Account_Management" "All_Changes.tag"="delete"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is discussed with my solution here:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/719456/how-do-you-prevent-the-map-command-from-encapsulat.html"&gt;https://answers.splunk.com/answers/719456/how-do-you-prevent-the-map-command-from-encapsulat.html&lt;/A&gt;&lt;BR /&gt;
So try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup "Correlation_searches.csv" 
| head 1
| map search="[|makeresults | eval check_search=$check_search$ | return $check_search]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 15:12:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440022#M125144</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-07T15:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440023#M125145</link>
      <description>&lt;P&gt;Hi, thanks for your help. &lt;BR /&gt;
That didn't work for some reason. &lt;BR /&gt;
The result was the same as the first query (with the \" ). &lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 06:57:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440023#M125145</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-12T06:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440024#M125146</link>
      <description>&lt;P&gt;Hi @astatrial,&lt;/P&gt;

&lt;P&gt;The problem is not in your query but in your CSV file. Make sure the searches in the CSV file are not in quotes as that is what is breaking your search.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David &lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 14:51:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440024#M125146</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-12T14:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440025#M125147</link>
      <description>&lt;P&gt;Hi David. &lt;BR /&gt;
Actually the csv file is fine. I think the problem is with the map command adding \ before the " &lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 15:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440025#M125147</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-12T15:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440026#M125148</link>
      <description>&lt;P&gt;No double quotes in the CSV file ?&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 15:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440026#M125148</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-12T15:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440027#M125149</link>
      <description>&lt;P&gt;I checked and there aren't. &lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 15:11:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440027#M125149</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-12T15:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440028#M125150</link>
      <description>&lt;P&gt;Have a look here if it's the \ causing the problem : &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Escape_the_.24_token_delimiter_character"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Escape_the_.24_token_delimiter_character&lt;/A&gt;&lt;BR /&gt;
You can try to escape your search token using |s or |n like : $check_search|s$&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 15:22:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440028#M125150</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-12T15:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440029#M125151</link>
      <description>&lt;P&gt;Tried it but it didn't work. Thanks anyway.&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 15:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440029#M125151</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-05-12T15:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with map command - Using search from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440030#M125152</link>
      <description>&lt;P&gt;Escaping the double-quotes is absolutely necessary because the map clauses is always in double-quotes.  Test my solution with a simpler search string that does not need/have any double-quotes.  Try to eliminate variables.&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 17:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-map-command-Using-search-from-lookup/m-p/440030#M125152</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-12T17:37:40Z</dc:date>
    </item>
  </channel>
</rss>

