<?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 pass values from previous search into map search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500524#M139352</link>
    <description>&lt;P&gt;Do you mind editing your question and re-posting your query, but using the code sample box so the formatting is protected?  Your query is getting roughed up a bit due to some escaping happening unintentionally with astericks.  I believe this is your query but feel free to correct me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tcxelevate_webpos registerType=kioskBridge registerNbr=* countryCode=US tagName=CLIENT_INITIALIZATION enterpriseId=prod storeId=* storeId!=4184 AND storeId!=0001 
| eval regNbr=registerNbr 
| eval storeNbr=storeId 
| spath output="Store" "storeId" 
| spath output="Country" "countryCode" 
| spath output="Lane" "registerNbr" 
| spath output="Time" "timestamp" 
| spath output="Reloads" "tagName" 
| localize timebefore=5m 
| map search="search index=tcxelevate_webpos registerType=kioskBridge registerNbr= regNbr countryCode=US enterpriseId=prod storeId=storeNbr earliest=$starttime$ latest=$endtime$" 
| spath output="Command" "command" 
| eval request=case(true(), "debug") 
| eval response=case(true(), "debug") 
| stats values(Country) as Country, latest(Command) as Command, latest(request) as Request, latest(response) as Response, values(Reloads) as Reloads by Store, Lane, Time 
| table Time, Reloads, Command, Request, Response, Store, Lane, Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 Oct 2019 20:50:28 GMT</pubDate>
    <dc:creator>dmarling</dc:creator>
    <dc:date>2019-10-10T20:50:28Z</dc:date>
    <item>
      <title>How to pass values from previous search into map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500523#M139351</link>
      <description>&lt;P&gt;Hello all, my search is below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tcxelevate_webpos registerType=kioskBridge registerNbr=* countryCode=US tagName=CLIENT_INITIALIZATION enterpriseId=prod storeId=* storeId!=4184 AND storeId!=0001 
| eval regNbr=registerNbr | eval storeNbr=storeId 
| spath output="Store" "storeId" 
| spath output="Country" "countryCode" 
| spath output="Lane" "registerNbr" 
| spath output="Time" "timestamp" 
| spath output="Reloads" "tagName" 
| localize timebefore=5m 
| map search="search index=tcxelevate_webpos registerType=kioskBridge registerNbr= regNbr countryCode=US enterpriseId=prod storeId=storeNbr earliest=$starttime$ latest=$endtime$" 
| spath output="Command" "command" 
| eval request=case(true(), "debug") 
| eval response=case(true(), "debug") 
| stats values(Country) as Country, latest(Command) as Command, latest(request) as Request, latest(response) as Response, values(Reloads) as Reloads by Store, Lane, Time 
| table Time, Reloads, Command, Request, Response, Store, Lane, Country
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see. I am trying to strip the register number from the first search into spath&lt;/P&gt;

&lt;P&gt;From there, I am trying to do a map search on all events that are pulled from the main search.&lt;/P&gt;

&lt;P&gt;In the map search. I try to set registerNbr equal to the variable I made with the spath.&lt;/P&gt;

&lt;P&gt;I am just trying to take the value for registerNbr from the first search, and store it. and refer to it later in my map search to narrow down the search.&lt;/P&gt;

&lt;P&gt;Any assistance? &lt;/P&gt;

&lt;P&gt;P.S. ignore my eval's with case statements. I haven't filled those out yet, but have working code that I will put in there after I am done testing to see if I can get the map search to work as I want it to.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 17:18:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500523#M139351</guid>
      <dc:creator>rlippincott</dc:creator>
      <dc:date>2019-10-10T17:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass values from previous search into map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500524#M139352</link>
      <description>&lt;P&gt;Do you mind editing your question and re-posting your query, but using the code sample box so the formatting is protected?  Your query is getting roughed up a bit due to some escaping happening unintentionally with astericks.  I believe this is your query but feel free to correct me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tcxelevate_webpos registerType=kioskBridge registerNbr=* countryCode=US tagName=CLIENT_INITIALIZATION enterpriseId=prod storeId=* storeId!=4184 AND storeId!=0001 
| eval regNbr=registerNbr 
| eval storeNbr=storeId 
| spath output="Store" "storeId" 
| spath output="Country" "countryCode" 
| spath output="Lane" "registerNbr" 
| spath output="Time" "timestamp" 
| spath output="Reloads" "tagName" 
| localize timebefore=5m 
| map search="search index=tcxelevate_webpos registerType=kioskBridge registerNbr= regNbr countryCode=US enterpriseId=prod storeId=storeNbr earliest=$starttime$ latest=$endtime$" 
| spath output="Command" "command" 
| eval request=case(true(), "debug") 
| eval response=case(true(), "debug") 
| stats values(Country) as Country, latest(Command) as Command, latest(request) as Request, latest(response) as Response, values(Reloads) as Reloads by Store, Lane, Time 
| table Time, Reloads, Command, Request, Response, Store, Lane, Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 20:50:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500524#M139352</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-10-10T20:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass values from previous search into map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500525#M139353</link>
      <description>&lt;P&gt;To refer to a field within &lt;CODE&gt;map&lt;/CODE&gt;, put the name of the field inside &lt;CODE&gt;$&lt;/CODE&gt;.  Tokens passed into the search are referred to using double &lt;CODE&gt;$&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | map search="search index=tcxelevate_webpos registerType=kioskBridge $registerNbr$= regNbr countryCode=US enterpriseId=prod storeId=storeNbr earliest=$$starttime$$ latest=$$endtime$$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 20:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-values-from-previous-search-into-map-search/m-p/500525#M139353</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-10T20:50:45Z</dc:date>
    </item>
  </channel>
</rss>

