<?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: Match search value to a range within a CSV Lookup in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449857#M78126</link>
    <description>&lt;P&gt;I've tried this solution, I cannot get the parent search to expose the variables in the subsearch. &lt;/P&gt;

&lt;P&gt;either the lookup LAT or the search LAT is null, I cannot figure out how to get them to be on the same line.&lt;/P&gt;

&lt;P&gt;Pseudocode would look something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for(User u : users) {
   for(Home h: homes) {
      if(u.getLat() + 2 &amp;lt; h.getLat() &amp;amp;&amp;amp; u.getLat() -2 &amp;gt; h.getLat() ) {
         u.setHome(h.getHome());
       }
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 May 2019 20:47:59 GMT</pubDate>
    <dc:creator>wrussell12</dc:creator>
    <dc:date>2019-05-10T20:47:59Z</dc:date>
    <item>
      <title>Match search value to a range within a CSV Lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449854#M78123</link>
      <description>&lt;P&gt;I have a drilldown search which can find a mobile devices lat/long.  I need to find the general geofence area of the users home. &lt;/P&gt;

&lt;P&gt;for example: The users home location is at: LAT 35.5 and LONG -118.5. &lt;BR /&gt;
Their mobile device is reading 35.4, -118.6. &lt;/P&gt;

&lt;P&gt;I need to increase the range  to allow of margin of error, such as LAT BETWEEN 35.4 AND 35.6, and LONG BETWEEN -118.4 AND 118.6&lt;/P&gt;

&lt;P&gt;I have a home.csv inputlookup such as: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LAT, LONG, HOME
35.5, -118.6  House1
30.5, -117.6  House2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The primary search returns Name, userLat, userLong&lt;BR /&gt;
I need to create a table that can show:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NAME, LAT, LONG, HOME
Will, 35.4, -118.5, House 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I currently have a search as &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats latest(username) as username, latest(userLat) as userLatitude, latest(userLong) as userLongitude 
| table username, userLatitude, userLongitude
| join [| inputlookup " home.csv" | eval Home=if( LAT&amp;lt;userLatitude + 0.01 
         AND LAT &amp;gt; userLatitude - 0.01 AND 
        LONG&amp;lt;userLongitude + 0.01 AND LONG &amp;gt; userLongitude - 0.01, HOME, "")  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Depending on my search, no results are returned, all users have the same home, as if it does not iterate though the homes.csv list. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;BR /&gt;
I have exhausted all my ideas, someone mentioned converting my CSV into a KML geolocation point file and creating alerts. &lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 01:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449854#M78123</guid>
      <dc:creator>wrussell12</dc:creator>
      <dc:date>2019-05-09T01:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Match search value to a range within a CSV Lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449855#M78124</link>
      <description>&lt;P&gt;I have tried to make results using eval and subsearch the inputlookup table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Status="Hello World"
| eval latitude=25.1
|join type=left [|inputlookup "airport_list.csv" | where LAT &amp;gt;= latitude | eval Status=if(LAT&amp;gt;latitude, Home, "NOT UPDATED")  | table LAT, Status, latitude]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Lookup Table&lt;/STRONG&gt;&lt;BR /&gt;
    LAT, LONG, HOME&lt;BR /&gt;
     35.5, -118.6  House1&lt;BR /&gt;
     30.5, -117.6  House2&lt;BR /&gt;
     2.2   , 35  House3&lt;/P&gt;

&lt;P&gt;My results from this test return:&lt;BR /&gt;
LAT | Status | _time | latitude&lt;BR /&gt;
empty | Hello World | timestamp | 25.1 &lt;/P&gt;

&lt;P&gt;It seems as though it never iterated though my lookup &lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 01:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449855#M78124</guid>
      <dc:creator>wrussell12</dc:creator>
      <dc:date>2019-05-10T01:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Match search value to a range within a CSV Lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449856#M78125</link>
      <description>&lt;P&gt;I feel, Splunk has to improve "lookup" command to cater for ranges&lt;BR /&gt;
But you can try an idea like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval latitude=35.4
|map search="|inputlookup home.csv | eval maxLAT=LAT+0.2| eval minLAT=LAT-0.2| where (maxLAT &amp;gt; $latitude$  AND minLAT &amp;lt; $latitude$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can extend this to Longitude and so on.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 10:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449856#M78125</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-10T10:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Match search value to a range within a CSV Lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449857#M78126</link>
      <description>&lt;P&gt;I've tried this solution, I cannot get the parent search to expose the variables in the subsearch. &lt;/P&gt;

&lt;P&gt;either the lookup LAT or the search LAT is null, I cannot figure out how to get them to be on the same line.&lt;/P&gt;

&lt;P&gt;Pseudocode would look something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for(User u : users) {
   for(Home h: homes) {
      if(u.getLat() + 2 &amp;lt; h.getLat() &amp;amp;&amp;amp; u.getLat() -2 &amp;gt; h.getLat() ) {
         u.setHome(h.getHome());
       }
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 May 2019 20:47:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449857#M78126</guid>
      <dc:creator>wrussell12</dc:creator>
      <dc:date>2019-05-10T20:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Match search value to a range within a CSV Lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449858#M78127</link>
      <description>&lt;P&gt;The best way to do this is to create your own &lt;CODE&gt;external lookup&lt;/CODE&gt; (AKA &lt;CODE&gt;scripted lookup&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Configureexternallookups"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Configureexternallookups&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;An even easier option would be to convert your lookup to a kmz and use a &lt;CODE&gt;geospatial lookup&lt;/CODE&gt;:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Configuregeospatiallookups"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Configuregeospatiallookups&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 05:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Match-search-value-to-a-range-within-a-CSV-Lookup/m-p/449858#M78127</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-11T05:37:54Z</dc:date>
    </item>
  </channel>
</rss>

