<?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: How to retain fields from base search to use after a map command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678101#M231897</link>
    <description>&lt;P&gt;The first command of the map search needs to be a generating command, such as rest. Try adding the eval afterwards.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Base Search&amp;gt; | stats count min(_time) as firstTime max(_time) as lastTime values(user) as user by user, src_ip, activity, riskLevel

|map maxsearches=100 search="| rest splunk_server=local /services/App/.../ ioc=\"$src_ip$\"
| eval activity=\"$activity$\""&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 20 Feb 2024 16:02:34 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-02-20T16:02:34Z</dc:date>
    <item>
      <title>How to retain fields from base search to use after a map command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678096#M231894</link>
      <description>&lt;P&gt;We have a search where one of the fields from base search is passed onto a REST API using map command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Base Search&amp;gt; | stats count min(_time) as firstTime max(_time) as lastTime values(user) as user by user, src_ip, activity, riskLevel

|map maxsearches=100 search="| rest splunk_server=local /services/App/.../ ioc="$src_ip$"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But after this search ,only the results returned by the REST API are shown. How can I include some of the fields from original search, e.g. user, activity so that they can later be used in a table?&lt;/P&gt;&lt;P&gt;Tried adding the field using eval right before the REST call but that doesn't seem to be working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval activity=\"$activity$\" | rest&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also tried using "multireport" but only the first search is considered.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| multireport  [ table user, src_ip, activity, riskLevel]
[| map map maxsearches=100 search="| rest splunk_server=local /services/App/.../ ioc="$src_ip$"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to achieve this? API call itself returns a set of fields which I am extracting using spath but also want to keep some of the original ones for added context.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;~Abhi&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 15:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678096#M231894</guid>
      <dc:creator>att35</dc:creator>
      <dc:date>2024-02-20T15:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain fields from base search to use after a map command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678101#M231897</link>
      <description>&lt;P&gt;The first command of the map search needs to be a generating command, such as rest. Try adding the eval afterwards.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Base Search&amp;gt; | stats count min(_time) as firstTime max(_time) as lastTime values(user) as user by user, src_ip, activity, riskLevel

|map maxsearches=100 search="| rest splunk_server=local /services/App/.../ ioc=\"$src_ip$\"
| eval activity=\"$activity$\""&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Feb 2024 16:02:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678101#M231897</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-02-20T16:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain fields from base search to use after a map command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678102#M231898</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 16:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retain-fields-from-base-search-to-use-after-a-map-command/m-p/678102#M231898</guid>
      <dc:creator>att35</dc:creator>
      <dc:date>2024-02-20T16:04:50Z</dc:date>
    </item>
  </channel>
</rss>

