<?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: Why when using &amp;quot;map&amp;quot; command, if I use the string argument with &amp;quot;map&amp;quot;, results are not displayed? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451378#M127826</link>
    <description>&lt;P&gt;I might misunderstood your question, but have a go with this run everywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| eval field1="test with space", bar="baz", field2=bar, field3=123
| map search="| stats count | fields - count | eval map_field1=\"$field1$\",map_field2=\"$field2$\",map_field3=\"$field3$\",map_bar=\"$bar$\" "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This might answer and/or clarify the issue. I reckon the important thing is to have the token field in the map search like this &lt;CODE&gt;\"$name$\"&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Tue, 11 Sep 2018 02:28:34 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2018-09-11T02:28:34Z</dc:date>
    <item>
      <title>Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451373#M127821</link>
      <description>&lt;P&gt;Splunk ver : 7.1.2&lt;/P&gt;

&lt;P&gt;When I use the &lt;CODE&gt;map&lt;/CODE&gt; command, if argument that pass to &lt;CODE&gt;map&lt;/CODE&gt; is string, results are never displayed.&lt;BR /&gt;
But, if argument is int or string that contains space, then it works!&lt;/P&gt;

&lt;P&gt;Below search is examples.&lt;BR /&gt;
* Since it is a sample, it is weird search, but please do not mind.&lt;/P&gt;

&lt;P&gt;Not working case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| eval field1="test"
| table field1 
| map search="| stats count | fields - count | eval map_field1=$field1$ | table map_field1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Working case1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| eval field1=111    
| table field1 
| map search="| stats count | fields - count | eval map_field1=$field1$ | table map_field1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Working case2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| eval field1="this is test"  
| table field1 
| map search="| stats count | fields - count | eval map_field1=$field1$ | table map_field1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is this specification, or issue?&lt;BR /&gt;
*if it is, I'm so sorry.&lt;/P&gt;

&lt;P&gt;Please someone tell me.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 09:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451373#M127821</guid>
      <dc:creator>yutaka1005</dc:creator>
      <dc:date>2018-09-07T09:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451374#M127822</link>
      <description>&lt;P&gt;hi @yutaka1005&lt;/P&gt;

&lt;P&gt;try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
 | eval field1=111
 | table field1 
 | map [search | stats count | fields - count | eval map_field1="$field1$" | table map_field1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Sep 2018 10:20:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451374#M127822</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-09-07T10:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451375#M127823</link>
      <description>&lt;P&gt;Thank you for answer!&lt;/P&gt;

&lt;P&gt;Problem was solved by doing like you taught me.&lt;/P&gt;

&lt;P&gt;But I wonder why I can't pass a string to &lt;CODE&gt;map&lt;/CODE&gt; unless I surround argument with double quote.&lt;BR /&gt;
Also I wonder why I can pass string that has space.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 00:37:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451375#M127823</guid>
      <dc:creator>yutaka1005</dc:creator>
      <dc:date>2018-09-10T00:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451376#M127824</link>
      <description>&lt;P&gt;Hi yutaka1005,&lt;/P&gt;

&lt;P&gt;you are using an &lt;CODE&gt;eval&lt;/CODE&gt; and using &lt;CODE&gt;field&lt;/CODE&gt; vs &lt;CODE&gt;"field"&lt;/CODE&gt; is not the same &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;using &lt;CODE&gt;field&lt;/CODE&gt; in an &lt;CODE&gt;eval&lt;/CODE&gt; will tell Splunk to use the values of the field &lt;CODE&gt;field&lt;/CODE&gt; &lt;/LI&gt;
&lt;LI&gt;using &lt;CODE&gt;"field"&lt;/CODE&gt; in an &lt;CODE&gt;eval&lt;/CODE&gt; will tell Splunk to use the string &lt;CODE&gt;field&lt;/CODE&gt; &lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;As example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval bar="111" | eval foo=bar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will result in &lt;CODE&gt;foo="111"&lt;/CODE&gt;, whereas &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval bar="111" | eval foo="bar"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will result in &lt;CODE&gt;foo="bar"&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this explains the &lt;EM&gt;problem&lt;/EM&gt; you encountered.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 01:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451376#M127824</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-09-10T01:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451377#M127825</link>
      <description>&lt;P&gt;Thank you for comment.&lt;/P&gt;

&lt;P&gt;So, you means below, right?&lt;/P&gt;

&lt;P&gt;If I pass int to &lt;CODE&gt;map&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval bar=111 | map [ | eval foo=$bar$ ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Although 111 is passed to &lt;CODE&gt;map&lt;/CODE&gt; without double quote, int is defined as value(*not as field), so result is &lt;CODE&gt;foo=111&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;If I pass string to &lt;CODE&gt;map&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval bar="test" | map [ | eval foo=$bar$ ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Because string without double quote is defined as field, so result is &lt;CODE&gt;foo=test&lt;/CODE&gt;.&lt;BR /&gt;
Then there is not &lt;CODE&gt;test&lt;/CODE&gt; field, so result is never displayed.&lt;/P&gt;

&lt;P&gt;Therefore, I should surround argument in &lt;CODE&gt;map&lt;/CODE&gt; with double quote.&lt;BR /&gt;
I was able to accept until here.&lt;/P&gt;

&lt;P&gt;But I wonder why it working when using pass string that has space without double quote.&lt;/P&gt;

&lt;P&gt;Such case like below, although argument in &lt;CODE&gt;map&lt;/CODE&gt; is not surrounded with double quote, result is &lt;CODE&gt;foo="this is test"&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval bar="this is test" | map [ | eval foo=$bar$ ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 00:53:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451377#M127825</guid>
      <dc:creator>yutaka1005</dc:creator>
      <dc:date>2018-09-11T00:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why when using "map" command, if I use the string argument with "map", results are not displayed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451378#M127826</link>
      <description>&lt;P&gt;I might misunderstood your question, but have a go with this run everywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| eval field1="test with space", bar="baz", field2=bar, field3=123
| map search="| stats count | fields - count | eval map_field1=\"$field1$\",map_field2=\"$field2$\",map_field3=\"$field3$\",map_bar=\"$bar$\" "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This might answer and/or clarify the issue. I reckon the important thing is to have the token field in the map search like this &lt;CODE&gt;\"$name$\"&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 02:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-when-using-quot-map-quot-command-if-I-use-the-string/m-p/451378#M127826</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-09-11T02:28:34Z</dc:date>
    </item>
  </channel>
</rss>

