<?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/Join Search query with lookup, when field in null in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337970#M100250</link>
    <description>&lt;P&gt;Thank you !! slight changes worked for me. &lt;/P&gt;</description>
    <pubDate>Thu, 15 Mar 2018 09:22:47 GMT</pubDate>
    <dc:creator>AKG1_old1</dc:creator>
    <dc:date>2018-03-15T09:22:47Z</dc:date>
    <item>
      <title>Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337963#M100243</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to Join/map  Search query result with lookup table. I am close to perfect query, Just not be able to handle one case (When Type=NULL in lookup table)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search Query Output and Lookup Table&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4517i0FC016B1522E305B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Requirement:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;To check in Lookup and match Context_Command(lookup) with Context+Command(query)  AND  TYPE (Query) with Type(Lookup). If both condition true it add all columns from lookup to search results.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4518iDD09B7073531B6F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I am able to merge search query and lookup except one condition. If Type=”” in lookup, It’s not doing anything. My requirement is if Type=”” in lookup, it still append values for Tags, Type, Threshold etc.  to the search query output from lookup.&lt;/P&gt;

&lt;P&gt;That means Last row of search query output should show data from last row in lookup. ( Alert = TRUE, Threshhold=2,Tags=TAG3 ) &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;My Query:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Base search query to produce data without lookup&amp;gt;
| lookup &amp;lt;Lookup Name&amp;gt; Context_Command AS "Context+Command" Type as "TYPE"  OUTPUT Tags CC_Description Threshold Alert
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: If Type is not defined in lookup then its generic and should check only Context+Command and add fields to all matching events.&lt;/P&gt;

&lt;P&gt;Could anyone please suggest any workaround ? Thanks for help&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 17:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337963#M100243</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2018-03-09T17:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337964#M100244</link>
      <description>&lt;P&gt;I think you will get the results you want if you use &lt;CODE&gt;fillnull&lt;/CODE&gt; immediately before the lookup, because I believe the issue is that the field is NULL in the events returned from the query. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt;
| fillnull value="" TYPE
| lookup &amp;lt;Lookup Name&amp;gt; Context_Command AS "Context+Command" Type as "TYPE"  OUTPUT Tags CC_Description Threshold Alert
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 17:17:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337964#M100244</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-09T17:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337965#M100245</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Thanks for Reply, but above solution is not working.&lt;/LI&gt;
&lt;LI&gt;Sorry it was not clear before but even TYPE="some other values " it should add fields from lookup. &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Condition : If &lt;STRONG&gt;Type&lt;/STRONG&gt; is not defined in lookup. In this case it should match only Context_Command(lookup) with Context+Command(search query) and append columns to all the matching events.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 17:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337965#M100245</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2018-03-09T17:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337966#M100246</link>
      <description>&lt;P&gt;So if the query result has a match in the lookup file when comparing both fields, you want that result. And if the query result does not have a match when comparing both fields, you want to match on the lookup file event that has a null value for Type - yes?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337966#M100246</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-09T18:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337967#M100247</link>
      <description>&lt;P&gt;yes !! Thats what I am looking for. Its like if user doen't specify Type in lookup, that means it's global and should apply to all matching fields based con Context+Command.&lt;/P&gt;

&lt;P&gt;If empty doesn't work, we can assign some value instead of blank. Such as "*"   (Type="*" in lookup).  &lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:21:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337967#M100247</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2018-03-09T18:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337968#M100248</link>
      <description>&lt;P&gt;Well, here's the approach I'm envisioning:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step One&lt;/STRONG&gt;&lt;BR /&gt;
You run the search as  you already have it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Base search query to produce data without lookup&amp;gt;
| lookup &amp;lt;Lookup Name&amp;gt; Context_Command AS "Context+Command" Type as "TYPE"  OUTPUT Tags CC_Description Threshold Alert
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At this point, you'll have some events that found a match, and those lines will have values populated into the fields Tags, CC_Description, Threshold, and Alert. But you'll also have some events that contain a value for "Context+Command" and TYPE but not the others.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;STEP TWO&lt;/STRONG&gt;&lt;BR /&gt;
Use an appendpipe command to deal with those events that aren't fully populated:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| appendpipe
[ | where isnull(Tags)
| rename TYPE AS BACKUP_TYPE
| eval TYPE=""
| lookup &amp;lt;Lookup Name&amp;gt; Context_Command AS "Context+Command" Type as "TYPE"  OUTPUT Tags CC_Description Threshold Alert 
| rename BACKUP_TYPE AS TYPE ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;STEP THREE&lt;/STRONG&gt;&lt;BR /&gt;
Then filter out the events that weren't fully populated before step two, because they will be duplicated by the events returned from step two.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where isnotnull(Tags)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this will only work if you expect every event entry to wind up getting fully populated. If that's not the case, you may need to use some dedup or stats magic.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337968#M100248</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-09T18:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337969#M100249</link>
      <description>&lt;P&gt;Thank you!! I'll give it a try and update you. &lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 11:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337969#M100249</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2018-03-12T11:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337970#M100250</link>
      <description>&lt;P&gt;Thank you !! slight changes worked for me. &lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 09:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337970#M100250</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2018-03-15T09:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Map/Join Search query with lookup, when field in null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337971#M100251</link>
      <description>&lt;P&gt;Glad to hear it! &lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 13:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Map-Join-Search-query-with-lookup-when-field-in-null/m-p/337971#M100251</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-15T13:44:07Z</dc:date>
    </item>
  </channel>
</rss>

