<?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: map command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511851#M143523</link>
    <description>&lt;P&gt;In checking the search log, I see this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;07-30-2020 15:48:30.388 INFO  SearchParser - PARSING: search "index=_audit" user=admin savedsearch_name=*\n| where len(savedsearch_name) &amp;gt; 1\n| eval User = admin, LogSource = "index=_audit"\n| table LogSource, savedsearch_name, _time, user&lt;/LI-CODE&gt;&lt;P&gt;It would appear that the $index$ token is being used literally, including the quotation marks.&amp;nbsp; That, of course, breaks the search.&lt;/P&gt;&lt;P&gt;Why can you not put &lt;FONT face="courier new,courier"&gt;index=$index$&lt;/FONT&gt; in &lt;FONT face="courier new,courier"&gt;map&lt;/FONT&gt; and set the token to the index name?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2020 20:12:01 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-07-30T20:12:01Z</dc:date>
    <item>
      <title>map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511809#M143508</link>
      <description>&lt;P&gt;Can I use the map command with the variable being the index and/or sourcetype?&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval User = "12345", index = "index=_audit"&lt;BR /&gt;| table User,&amp;nbsp;index&amp;nbsp;&lt;BR /&gt;| map search="search $index$ user="$User$"&lt;BR /&gt;| table field_1, field_2"&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 17:03:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511809#M143508</guid>
      <dc:creator>kgrahamLM</dc:creator>
      <dc:date>2020-07-30T17:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511836#M143514</link>
      <description>If the field exists prior to the map command then you should be able to use it within the command. Have you tried it?</description>
      <pubDate>Thu, 30 Jul 2020 18:49:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511836#M143514</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-30T18:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511838#M143516</link>
      <description>&lt;P&gt;The field 'index' exists and contains '&lt;SPAN&gt;index=_audit', however, it won't render.&amp;nbsp; I get an error message.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 19:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511838#M143516</guid>
      <dc:creator>kgrahamLM</dc:creator>
      <dc:date>2020-07-30T19:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511843#M143519</link>
      <description>&lt;P&gt;When testing..... I hard coded 'index=_audit" and the results rendered.&amp;nbsp; (see below)&lt;BR /&gt;&lt;BR /&gt;| makeresults&lt;BR /&gt;| eval User = "1234", index = "index=_audit"&lt;BR /&gt;| table User, index&lt;BR /&gt;`comment(" -------------------- GET LIST OF JOBS THAT RAN FOR THIS USER -------------------- ")`&lt;BR /&gt;| map search="search &lt;STRONG&gt;index=_audit&lt;/STRONG&gt; user="$User$" savedsearch_name=*&lt;BR /&gt;| where len(savedsearch_name) &amp;gt; 1&lt;BR /&gt;| eval &lt;STRONG&gt;User&lt;/STRONG&gt; = "$User$",&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LogSource&lt;/STRONG&gt; = "$index$"&lt;BR /&gt;| table LogSource, User, savedsearch_name, _time, user "&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;LogSource&lt;/STRONG&gt; outputs: &lt;STRONG&gt;index=_audit&lt;/STRONG&gt;&lt;BR /&gt;but&lt;BR /&gt;&lt;STRONG&gt;User&lt;/STRONG&gt; does NOT output 1234&lt;/P&gt;&lt;P&gt;Can't think of why!&lt;/P&gt;&lt;P&gt;Then I replace the hardcoded index with the variable and it returns 0 results.&lt;BR /&gt;| makeresults&lt;BR /&gt;| eval User = "1234", index = "index=_audit"&lt;BR /&gt;| table User, index&lt;BR /&gt;`comment(" -------------------- GET LIST OF JOBS THAT RAN FOR THIS USER -------------------- ")`&lt;BR /&gt;| map search="search &lt;STRONG&gt;$index$&lt;/STRONG&gt; user="$User$" savedsearch_name=*&lt;BR /&gt;| where len(savedsearch_name) &amp;gt; 1&lt;BR /&gt;| eval User = "$User$", LogSource = "$index$"&lt;BR /&gt;| table LogSource, User, savedsearch_name, _time, user "&lt;/P&gt;&lt;P&gt;Is there something wrong with my syntax?&amp;nbsp; If I get it working I plan on substituting the | makeresults with a lookup to get multiple items.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 19:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511843#M143519</guid>
      <dc:creator>kgrahamLM</dc:creator>
      <dc:date>2020-07-30T19:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511844#M143520</link>
      <description>What is the error message?</description>
      <pubDate>Thu, 30 Jul 2020 19:30:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511844#M143520</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-30T19:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511851#M143523</link>
      <description>&lt;P&gt;In checking the search log, I see this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;07-30-2020 15:48:30.388 INFO  SearchParser - PARSING: search "index=_audit" user=admin savedsearch_name=*\n| where len(savedsearch_name) &amp;gt; 1\n| eval User = admin, LogSource = "index=_audit"\n| table LogSource, savedsearch_name, _time, user&lt;/LI-CODE&gt;&lt;P&gt;It would appear that the $index$ token is being used literally, including the quotation marks.&amp;nbsp; That, of course, breaks the search.&lt;/P&gt;&lt;P&gt;Why can you not put &lt;FONT face="courier new,courier"&gt;index=$index$&lt;/FONT&gt; in &lt;FONT face="courier new,courier"&gt;map&lt;/FONT&gt; and set the token to the index name?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 20:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511851#M143523</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-30T20:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511919#M143547</link>
      <description>&lt;P&gt;I can't hardcode index because sometimes I will be looking for different variations like: index only or index and sourcetype.&amp;nbsp; Is there a way to escape the quote within the map command?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 12:23:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511919#M143547</guid>
      <dc:creator>kgrahamLM</dc:creator>
      <dc:date>2020-07-31T12:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: map command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511926#M143550</link>
      <description>I was unable to find a way to suppress or escape the quotation marks. IMO, the presence of quotation marks in the parsed search is a bug. Consider submitting a support request to Splunk.</description>
      <pubDate>Fri, 31 Jul 2020 13:24:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-command/m-p/511926#M143550</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-31T13:24:59Z</dc:date>
    </item>
  </channel>
</rss>

