<?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 do you create a lookup from a range of values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/670947#M229961</link>
    <description>&lt;P&gt;Transform your lookup in a way, that every productID has a row. Then you can use the lookup in its native way.&lt;/P&gt;&lt;P&gt;It will lead to large lookup files, but the lookup itself is still very performant.&lt;/P&gt;&lt;P&gt;Every workaround with map, subsearch etc. will be slow and imperformant.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 07:57:13 GMT</pubDate>
    <dc:creator>blablabla</dc:creator>
    <dc:date>2023-12-06T07:57:13Z</dc:date>
    <item>
      <title>How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423288#M121484</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to create a report in which I would like to get the field value by looking into a range of values that are stored as start and end values in 2 different fields.&lt;/P&gt;

&lt;P&gt;For example: lookup with below data&lt;BR /&gt;
ProductName,ProductIDStart,ProductIDEnd&lt;BR /&gt;
Choc,1,10&lt;BR /&gt;
IceCream,11,20&lt;BR /&gt;
Biscuit,21,30&lt;/P&gt;

&lt;P&gt;Index data as below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=a,type=purchase,productid=25
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;End report:&lt;BR /&gt;
type,productid,ProductName&lt;BR /&gt;
purchase,25,Biscuit&lt;/P&gt;

&lt;P&gt;I tried to use where condition with inputlookup, but that didn't work.&lt;BR /&gt;
    index=a |table type,productid |eval ProductName=[|inputlookup lookupname where productid&amp;gt;ProductIDStart AND productid&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 22:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423288#M121484</guid>
      <dc:creator>siva_cg</dc:creator>
      <dc:date>2018-12-04T22:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423289#M121485</link>
      <description>&lt;P&gt;Try something like this index=a | map  search="| inputlookup lookupname | where ProductIDStart&amp;gt; $ProductID$ AND $ProductID$ &amp;lt; ProductIDEnd| table  ProductName "| table type,productid,ProductName&lt;/P&gt;

&lt;P&gt;index=a | map  search="| inputlookup lookupname | where ProductIDStart&amp;gt;\" $ProductID$\" AND \"$ProductID$\" &amp;lt; ProductIDEnd| table  ProductName "| table type,productid,ProductName&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 00:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423289#M121485</guid>
      <dc:creator>nagarjuna280</dc:creator>
      <dc:date>2018-12-05T00:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423290#M121486</link>
      <description>&lt;P&gt;Hi @nagarjuna280,&lt;BR /&gt;
Thank you for the response. I have tried the below search but I am getting only ProductName in the end results. What could be the issue?&lt;/P&gt;

&lt;P&gt;index=a | map search="| inputlookup lookupname | where ProductIDStart&amp;gt; "$ProductID$" AND "$ProductID$" &amp;lt; ProductIDEnd| table ProductName "| table type,productid,ProductName&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 18:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423290#M121486</guid>
      <dc:creator>siva_cg</dc:creator>
      <dc:date>2018-12-05T18:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423291#M121487</link>
      <description>&lt;P&gt;Try this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Text="a,purchase,25" 
| eval index=mvindex(split(Text,","),0) 
| eval type=mvindex(split(Text,","),1) 
| eval productid=mvindex(split(Text,","),2) 
| table _time productid type index 
| map search="| inputlookup  yourlookup.csv where ProductStart&amp;lt; "$productid$" AND ProductEnd &amp;gt; "$productid$""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 22:41:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423291#M121487</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-05T22:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423292#M121488</link>
      <description>&lt;P&gt;Replace the search above table command with your main search.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 22:41:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423292#M121488</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-05T22:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423293#M121489</link>
      <description>&lt;P&gt;Hi @macadminrohit ,&lt;BR /&gt;
Sorry for the late response. I am not getting any results in this case.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 10:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423293#M121489</guid>
      <dc:creator>siva_cg</dc:creator>
      <dc:date>2018-12-07T10:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423294#M121490</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I created test.csv lookup according to your problem like below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ProductName,ProductIDStart,ProductIDEnd
Choc,1,10
IceCream,11,20
Biscuit,21,30
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is my indexed data(data.txt) in main index,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;type,productid
purchase,25
purchase,14
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The below search I am using to look for the range,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="data.txt" sourcetype="csv" 
|  table type,productid
|  map search="|inputlookup test |  where ProductIDEnd &amp;gt; $productid$ AND ProductIDStart &amp;lt; $productid$| eval type = $type$ productid=$productid$ | table type,productid,ProductName "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that will answer your question.&lt;/P&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 11:14:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423294#M121490</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2018-12-07T11:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423295#M121491</link>
      <description>&lt;P&gt;Hi @sdchakraborty ,&lt;BR /&gt;
Sorry. It didn't give me expected output. I am expecting ProductName, type and productid in the output but details from index are missing using map command.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423295#M121491</guid>
      <dc:creator>siva_cg</dc:creator>
      <dc:date>2018-12-07T13:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423296#M121492</link>
      <description>&lt;P&gt;Inside the map search you can pass those filed values from outer search just like we passed productId. So please add the below command inside the map search end.&lt;/P&gt;

&lt;P&gt;| table $peoductname$, $productid$ ...&lt;BR /&gt;
The output will have those fields as well. Let me know how it goes.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 14:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423296#M121492</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2018-12-07T14:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423297#M121493</link>
      <description>&lt;P&gt;Hi @sdchakraborty,&lt;BR /&gt;
Modifying the query a little more gave me the output as expected. Thank you all for the help. Final query I used is as below:&lt;/P&gt;

&lt;P&gt;index=a | map search="| inputlookup lookupname | where ProductIDStart&amp;gt; "$productid$" AND "$productid$" &amp;lt; ProductIDEnd| eval productid="$productid$" |eval type="$type$" | table type,productid,ProductName"&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 15:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423297#M121493</guid>
      <dc:creator>siva_cg</dc:creator>
      <dc:date>2018-12-07T15:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423298#M121494</link>
      <description>&lt;P&gt;I have updated my answer as well. Please accept is as answer when you get time. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 15:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423298#M121494</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2018-12-07T15:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423299#M121495</link>
      <description>&lt;P&gt;That might be because you didnt put your lookup. I tested this in my environment and it worked like a charm.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 16:19:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/423299#M121495</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-07T16:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/670946#M229960</link>
      <description>&lt;P&gt;I do not recommend to use map. It is an extremely slow command.&lt;/P&gt;&lt;P&gt;As far as I know Splunk unfortunately does not support range lookups. We also had this issue and at the end we transformed our lookup file in a way, that every value of the range is a single row.&lt;/P&gt;&lt;P&gt;It leads to large lookup files but performing the lookup is still much more performant than map or similar commands&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:53:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/670946#M229960</guid>
      <dc:creator>blablabla</dc:creator>
      <dc:date>2023-12-06T07:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a lookup from a range of values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/670947#M229961</link>
      <description>&lt;P&gt;Transform your lookup in a way, that every productID has a row. Then you can use the lookup in its native way.&lt;/P&gt;&lt;P&gt;It will lead to large lookup files, but the lookup itself is still very performant.&lt;/P&gt;&lt;P&gt;Every workaround with map, subsearch etc. will be slow and imperformant.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:57:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-lookup-from-a-range-of-values/m-p/670947#M229961</guid>
      <dc:creator>blablabla</dc:creator>
      <dc:date>2023-12-06T07:57:13Z</dc:date>
    </item>
  </channel>
</rss>

