<?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 use a lookup without exact match (between values) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356668#M93809</link>
    <description>&lt;P&gt;The only thing I can think of is rather slow to run, especially if you are looking up a lot of &lt;CODE&gt;csc_posture_name_key&lt;/CODE&gt; values, but it ought to work. (If anyone has a working solution that doesn't use &lt;CODE&gt;map&lt;/CODE&gt;, then go with that!) But try this:&lt;/P&gt;

&lt;PRE&gt;| inputlookup CSC_value 
| lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name 
| lookup CSC_tree _key as csc_tree_key output name as tree_name 
| map search="| inputlookup CSC_posture_value where csc_posture_name_key=$csc_posture_name_key$ 
              | where min&amp;lt;=$value$ AND $value$&amp;lt;=max"
&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 Nov 2017 14:02:38 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2017-11-09T14:02:38Z</dc:date>
    <item>
      <title>How to use a lookup without exact match (between values)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356666#M93807</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have created a query that uses a couple of input lookups.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup CSC_value | lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name | lookup CSC_tree _key as csc_tree_key output name as tree_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    creationdate     csc_posture_name_key    csc_tree_key    posture_name      tree_name    value

    1510132678       59e9ec538cb36149        59e9e6728cb     Policy Defined    test1        19
    1510132888       59e9ec538cb36149        aee363bb0b1     Policy Impleme    test2        43
    1510132888       23a4cb4254bba123        aee363bb0b1     Policy Impleme    test3        49
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result I get is ok, but the next step is to do a lookup for each result from above query into another lookup (CSC_posture_value), where I have to match exact on the csc_posture_name_key (not the problem) but also to find the row where the "value" from above query is between min and max and to return the name.&lt;/P&gt;

&lt;P&gt;Here is how the CSC_posture_value looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;csc_posture_name_key    name          min      max

59e9ec538cb36149        A Low         0        19
59e9ec538cb36149        A Medium      20       39
59e9ec538cb36149        A OK          40       59
59e9ec538cb36149        A High        60       79
59e9ec538cb36149        A Critical    80       100
23a4cb4254bba123        B Low         0        19
23a4cb4254bba123        B Medium      20       39
23a4cb4254bba123        B OK          40       59
23a4cb4254bba123        B High        60       79
23a4cb4254bba123        B Critical    80       100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next query works to match on the csc_posture_name_key, but It returns all names for that csc_posture_name_key.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup CSC_value | lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name | lookup CSC_tree _key as csc_tree_key output name as tree_name | lookup CSC_posture_value csc_posture_name_key output name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want it to return only the name that matches the csc_posture_name_key AND where the value is between min and max.&lt;BR /&gt;
I tried this, but that's not working, but it is to give you an idea what I need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup CSC_value | lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name | lookup CSC_tree _key as csc_tree_key output name as tree_name | lookup CSC_posture_value csc_posture_name_key, value&amp;gt;=min, value&amp;lt;= max output name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any suggestions?&lt;BR /&gt;
Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356666#M93807</guid>
      <dc:creator>rheylen</dc:creator>
      <dc:date>2020-09-29T16:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a lookup without exact match (between values)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356667#M93808</link>
      <description>&lt;P&gt;you could do after your Search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | inputlookup CSC_value | lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name | lookup CSC_tree _key as csc_tree_key output name as tree_name | lookup CSC_posture_value csc_posture_name_key output value name| search (value&amp;gt;=min AND value&amp;lt;= max )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2017 11:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356667#M93808</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2017-11-09T11:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a lookup without exact match (between values)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356668#M93809</link>
      <description>&lt;P&gt;The only thing I can think of is rather slow to run, especially if you are looking up a lot of &lt;CODE&gt;csc_posture_name_key&lt;/CODE&gt; values, but it ought to work. (If anyone has a working solution that doesn't use &lt;CODE&gt;map&lt;/CODE&gt;, then go with that!) But try this:&lt;/P&gt;

&lt;PRE&gt;| inputlookup CSC_value 
| lookup CSC_posture_name _key as csc_posture_name_key output name as posture_name 
| lookup CSC_tree _key as csc_tree_key output name as tree_name 
| map search="| inputlookup CSC_posture_value where csc_posture_name_key=$csc_posture_name_key$ 
              | where min&amp;lt;=$value$ AND $value$&amp;lt;=max"
&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2017 14:02:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-a-lookup-without-exact-match-between-values/m-p/356668#M93809</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-11-09T14:02:38Z</dc:date>
    </item>
  </channel>
</rss>

