<?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 inputlookup in a map search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302476#M91033</link>
    <description>&lt;P&gt;Hi splunk fellows,&lt;/P&gt;

&lt;P&gt;Struggling a bit with the map command I never used before :&lt;/P&gt;

&lt;P&gt;| inputlookup myfile1.csv &lt;BR /&gt;
| append &lt;BR /&gt;
    [| inputlookup myfile2.csv  ]&lt;BR /&gt;
| where status!="H"&lt;BR /&gt;
| eventstats dc(status) as status_cnt by site_code&lt;BR /&gt;
| where status_cnt=1 and status="C" &lt;BR /&gt;
| table site_code &lt;BR /&gt;
  &lt;STRONG&gt;&lt;EM&gt;--&amp;gt; until here everything looks fine&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
| map search="|inputlookup myfile1.csv | where site_code=$site_code$"&lt;/P&gt;

&lt;P&gt;don't try too much to make sense out of it as I simplified the query but basically I'm filtering out events to get the ones I'm interested in and I create a table containing my site_code values. So far so good. Now I would like to use these values to select some specific entries in my lookup table with the map command but I'm not getting any results. It seems the $site_code$ variable is not filled in properly.&lt;/P&gt;

&lt;P&gt;Any advice ?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:37:27 GMT</pubDate>
    <dc:creator>cardinalga</dc:creator>
    <dc:date>2020-09-29T17:37:27Z</dc:date>
    <item>
      <title>inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302476#M91033</link>
      <description>&lt;P&gt;Hi splunk fellows,&lt;/P&gt;

&lt;P&gt;Struggling a bit with the map command I never used before :&lt;/P&gt;

&lt;P&gt;| inputlookup myfile1.csv &lt;BR /&gt;
| append &lt;BR /&gt;
    [| inputlookup myfile2.csv  ]&lt;BR /&gt;
| where status!="H"&lt;BR /&gt;
| eventstats dc(status) as status_cnt by site_code&lt;BR /&gt;
| where status_cnt=1 and status="C" &lt;BR /&gt;
| table site_code &lt;BR /&gt;
  &lt;STRONG&gt;&lt;EM&gt;--&amp;gt; until here everything looks fine&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
| map search="|inputlookup myfile1.csv | where site_code=$site_code$"&lt;/P&gt;

&lt;P&gt;don't try too much to make sense out of it as I simplified the query but basically I'm filtering out events to get the ones I'm interested in and I create a table containing my site_code values. So far so good. Now I would like to use these values to select some specific entries in my lookup table with the map command but I'm not getting any results. It seems the $site_code$ variable is not filled in properly.&lt;/P&gt;

&lt;P&gt;Any advice ?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:37:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302476#M91033</guid>
      <dc:creator>cardinalga</dc:creator>
      <dc:date>2020-09-29T17:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302477#M91034</link>
      <description>&lt;P&gt;Despite your assertion that we shouldn't "try too much to make sense out of it", I'm going to ask that you provide some basic details regarding what the data looks like and what you want to accomplish.  The reason for this is &lt;CODE&gt;map&lt;/CODE&gt; is a bad idea in most cases.  I think you'd be better served trying to find a better search, rather than troubleshooting this one.&lt;/P&gt;

&lt;P&gt;That said, academic exercises (ie solving this one even though you may not use the answer) are still great teachers.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 16:14:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302477#M91034</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-11T16:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302478#M91035</link>
      <description>&lt;P&gt;You would need to put &lt;CODE&gt;$site_code$&lt;/CODE&gt; in quotes, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup myfile1.csv 
| append 
[| inputlookup myfile2.csv ]
| where status!="H"
| eventstats dc(status) as status_cnt by site_code
| where status_cnt=1 and status="C" 
| table site_code 
| map [|inputlookup myfile1.csv | where site_code="$site_code$"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I changed &lt;CODE&gt;search="..."&lt;/CODE&gt; to &lt;CODE&gt;[...]&lt;/CODE&gt; to make this easier to read.&lt;/P&gt;

&lt;P&gt;You could combine the &lt;CODE&gt;where&lt;/CODE&gt; with the &lt;CODE&gt;inputlookup&lt;/CODE&gt;, as well:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup myfile1.csv 
| append 
[| inputlookup myfile2.csv ]
| where status!="H"
| eventstats dc(status) as status_cnt by site_code
| where status_cnt=1 and status="C" 
| table site_code 
| map [|inputlookup myfile1.csv where site_code=$site_code$]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that this version doesn't require double quotes around &lt;CODE&gt;$site_code$&lt;/CODE&gt;.  This is because the &lt;CODE&gt;where&lt;/CODE&gt; clause of &lt;CODE&gt;inputlookup&lt;/CODE&gt; assumes the right hand side will be a value, whereas the &lt;CODE&gt;where&lt;/CODE&gt; &lt;EM&gt;command&lt;/EM&gt; allows you to pass field names on the right hand side, or values if in quotes.  So your &lt;CODE&gt;| where&lt;/CODE&gt; thought you were saying &lt;CODE&gt;| where &amp;lt;fieldA&amp;gt;=&amp;lt;fieldB&amp;gt;&lt;/CODE&gt; instead of &lt;CODE&gt;|where &amp;lt;fieldA&amp;gt;=&amp;lt;valueB&amp;gt;&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 16:17:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302478#M91035</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-11T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302479#M91036</link>
      <description>&lt;P&gt;can you try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup myfile1.csv 
| append 
[| inputlookup myfile2.csv ]
| where status!="H"
| eventstats dc(status) as status_cnt by site_code
| where status_cnt=1 and status="C" 
| table site_code 
--&amp;gt; until here everything looks fine
| map search="|inputlookup myfile1.csv | where site_code=\"$site_code$\"" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this works!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 16:21:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302479#M91036</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-11T16:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302480#M91037</link>
      <description>&lt;P&gt;I had a typo in my searches. where I had &lt;CODE&gt;search=[&lt;/CODE&gt;.  When you use &lt;CODE&gt;[&lt;/CODE&gt; to define your map search instead of &lt;CODE&gt;"&lt;/CODE&gt; you don't also include the &lt;CODE&gt;search=&lt;/CODE&gt; component.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 17:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302480#M91037</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-11T17:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302481#M91038</link>
      <description>&lt;P&gt;This is working, many thanks for this. Actually my aim is to compare 2 lookup tables to find the list of site_codes I'm interested in. Then, based on this list, I need to modify some entries having the same site_code in the first lookup table. &lt;/P&gt;

&lt;P&gt;Sorry for not having accepted your answer, I thought it was possible to accept several answers but apparently it is not. Thank you anyway for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302481#M91038</guid>
      <dc:creator>cardinalga</dc:creator>
      <dc:date>2020-09-29T17:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup in a map search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302482#M91039</link>
      <description>&lt;P&gt;This one is working too. thanks for the explanation&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 07:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-in-a-map-search/m-p/302482#M91039</guid>
      <dc:creator>cardinalga</dc:creator>
      <dc:date>2018-01-12T07:02:18Z</dc:date>
    </item>
  </channel>
</rss>

