<?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: Determine numerical value belong to intervals which stored in static lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188126#M187079</link>
    <description>&lt;P&gt;Hi ejpulsar,&lt;/P&gt;

&lt;P&gt;I think this is not possible -- (speaking Splunk Version &amp;lt; 6.2 - I don't know if this is now possible).&lt;/P&gt;

&lt;P&gt;But if those start and end values are static, you could use the the &lt;CODE&gt;EVAL-&lt;/CODE&gt; function in &lt;CODE&gt;props.conf&lt;/CODE&gt; for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-&amp;lt;fieldname&amp;gt; = &amp;lt;eval statement&amp;gt;
* Use this to automatically run the &amp;lt;eval statement&amp;gt; and assign the value of the output 
  to &amp;lt;fieldname&amp;gt;. This creates a "calculated field." 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Something like this could do the trick for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-Name = case((NUM&amp;gt;"100" AND NUM&amp;lt;"120"), "A", (NUM&amp;gt;"121" AND NUM&amp;lt;"180"), "B", (NUM&amp;gt;"180"), "C")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use this run everywhere command to test it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval NUM="182" | eval Name=case((NUM&amp;gt;"100" AND NUM&amp;lt;"120"), "A", (NUM&amp;gt;"121" AND NUM&amp;lt;"180"), "B", (NUM&amp;gt;"180"), "C") | table NUM Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 29 Oct 2014 12:40:10 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-10-29T12:40:10Z</dc:date>
    <item>
      <title>Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188125#M187078</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;
We've "broken" our heads on this.&lt;/P&gt;

&lt;P&gt;Let we have events with field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NUM=100
NUM=150
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And static lookup with interval looks like this (yes, we can change it format if needed):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NAME START END
 A     100 120
 B     121 180
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We need to produce evens like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NUM=100 NAME=A
NUM=150 NAME=B
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Oct 2014 08:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188125#M187078</guid>
      <dc:creator>ejpulsar</dc:creator>
      <dc:date>2014-10-29T08:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188126#M187079</link>
      <description>&lt;P&gt;Hi ejpulsar,&lt;/P&gt;

&lt;P&gt;I think this is not possible -- (speaking Splunk Version &amp;lt; 6.2 - I don't know if this is now possible).&lt;/P&gt;

&lt;P&gt;But if those start and end values are static, you could use the the &lt;CODE&gt;EVAL-&lt;/CODE&gt; function in &lt;CODE&gt;props.conf&lt;/CODE&gt; for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-&amp;lt;fieldname&amp;gt; = &amp;lt;eval statement&amp;gt;
* Use this to automatically run the &amp;lt;eval statement&amp;gt; and assign the value of the output 
  to &amp;lt;fieldname&amp;gt;. This creates a "calculated field." 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Something like this could do the trick for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-Name = case((NUM&amp;gt;"100" AND NUM&amp;lt;"120"), "A", (NUM&amp;gt;"121" AND NUM&amp;lt;"180"), "B", (NUM&amp;gt;"180"), "C")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use this run everywhere command to test it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval NUM="182" | eval Name=case((NUM&amp;gt;"100" AND NUM&amp;lt;"120"), "A", (NUM&amp;gt;"121" AND NUM&amp;lt;"180"), "B", (NUM&amp;gt;"180"), "C") | table NUM Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2014 12:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188126#M187079</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-10-29T12:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188127#M187080</link>
      <description>&lt;P&gt;If you can change the format of static lookup file, then you can change it to have just the fields NAME and NUM, where NUM will be all the integer values from START to END.&lt;/P&gt;

&lt;P&gt;You can generate the new lookup file (with NAME and NUM) from existing lookup (NAME, START, END) using following splunk search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup yourOldLookup | eval NUM=mvrange(START,END+1) | mvexpand NUM | table NAME, NUM | outputlookup youNewLookup
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Oct 2014 14:45:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188127#M187080</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-10-29T14:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188128#M187081</link>
      <description>&lt;P&gt;We've tried this way. Unfortunately intervals is so big and resulting lookup over 10-20GB in size.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 06:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188128#M187081</guid>
      <dc:creator>ejpulsar</dc:creator>
      <dc:date>2014-10-30T06:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188129#M187082</link>
      <description>&lt;P&gt;Got it!&lt;/P&gt;

&lt;P&gt;With expanding case argument by subsearch&lt;BR /&gt;
Thanks to all for help!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eval NUM=150 | eval NAME=case([|inputlookup name_range.csv| eval argument="NUM&amp;gt;=".interval_begin." AND  NUM&amp;lt;=".interval_end.",\"".name."\"" | stats values(argument) as argument | eval argument=mvjoin(argument,",")|return $argument])
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Oct 2014 07:40:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188129#M187082</guid>
      <dc:creator>ejpulsar</dc:creator>
      <dc:date>2014-10-30T07:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188130#M187083</link>
      <description>&lt;P&gt;As you see below, its possible now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 07:46:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188130#M187083</guid>
      <dc:creator>ejpulsar</dc:creator>
      <dc:date>2014-10-30T07:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Determine numerical value belong to intervals which stored in static lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188131#M187084</link>
      <description>&lt;P&gt;nice - looks like I misunderstood your initial question, because doing this by using only a &lt;CODE&gt;lookup&lt;/CODE&gt; command is not possible (I think) &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 08:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Determine-numerical-value-belong-to-intervals-which-stored-in/m-p/188131#M187084</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-10-30T08:20:41Z</dc:date>
    </item>
  </channel>
</rss>

