<?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 loop search for ranges mapping in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181346#M44796</link>
    <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;While mapping ip-addresses to cities using &lt;CODE&gt;iplocation&lt;/CODE&gt; or &lt;CODE&gt;geoip&lt;/CODE&gt; commands, they returned just 65% of matched ip+cities. There's another geoip database that have more full information concerning my region. &lt;BR /&gt;
Ip-addresses there are grouped in ranges that are converted into numeric format (ip address a.b.c.d is converted this way: &lt;CODE&gt;a*256*256*256+b*256*256+c*256+d&lt;/CODE&gt;) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;city    range                      range_start  range_end   region
city1   2.60.0.0 - 2.60.255.255    37486592     37552127    region1 
city2   2.61.0.0 - 2.61.255.255    37552128     37617663    region2
city3   2.62.0.0 - 2.62.255.255    37617664     37683199    region3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;csv file of 38k lines&lt;/P&gt;

&lt;P&gt;And file with 700k ip-s that is needed to be matched with cities above, looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ip_address  ip_converted 
2.60.0.0    37486592
2.61.0.0    37552128
2.62.0.0    37617664
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Each ip_converted value shoud be checked against all ranges to find one where this statement is true: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;range_start &amp;lt;= ip_converted &amp;lt;= range_end 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can this matching be done in splunk? I've tried &lt;CODE&gt;map&lt;/CODE&gt; but it's not for this case.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Aug 2014 08:27:40 GMT</pubDate>
    <dc:creator>iKate</dc:creator>
    <dc:date>2014-08-14T08:27:40Z</dc:date>
    <item>
      <title>loop search for ranges mapping</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181346#M44796</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;While mapping ip-addresses to cities using &lt;CODE&gt;iplocation&lt;/CODE&gt; or &lt;CODE&gt;geoip&lt;/CODE&gt; commands, they returned just 65% of matched ip+cities. There's another geoip database that have more full information concerning my region. &lt;BR /&gt;
Ip-addresses there are grouped in ranges that are converted into numeric format (ip address a.b.c.d is converted this way: &lt;CODE&gt;a*256*256*256+b*256*256+c*256+d&lt;/CODE&gt;) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;city    range                      range_start  range_end   region
city1   2.60.0.0 - 2.60.255.255    37486592     37552127    region1 
city2   2.61.0.0 - 2.61.255.255    37552128     37617663    region2
city3   2.62.0.0 - 2.62.255.255    37617664     37683199    region3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;csv file of 38k lines&lt;/P&gt;

&lt;P&gt;And file with 700k ip-s that is needed to be matched with cities above, looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ip_address  ip_converted 
2.60.0.0    37486592
2.61.0.0    37552128
2.62.0.0    37617664
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Each ip_converted value shoud be checked against all ranges to find one where this statement is true: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;range_start &amp;lt;= ip_converted &amp;lt;= range_end 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can this matching be done in splunk? I've tried &lt;CODE&gt;map&lt;/CODE&gt; but it's not for this case.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 08:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181346#M44796</guid>
      <dc:creator>iKate</dc:creator>
      <dc:date>2014-08-14T08:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: loop search for ranges mapping</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181347#M44797</link>
      <description>&lt;P&gt;You could put CIDR ranges into your CSV file, e.g. &lt;CODE&gt;2.60.0.0/16&lt;/CODE&gt; for the first line, &lt;CODE&gt;2.61.0.0/16&lt;/CODE&gt; for the second line, and so on. Using that column, Splunk can match individual IPs against that list of CIDR ranges and enrich the events with the other columns from that lookup. See &lt;A href="http://answers.splunk.com/answers/5916/using-cidr-in-a-lookup-table/46866"&gt;http://answers.splunk.com/answers/5916/using-cidr-in-a-lookup-table/46866&lt;/A&gt; for an example.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 09:20:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181347#M44797</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-08-14T09:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: loop search for ranges mapping</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181348#M44798</link>
      <description>&lt;P&gt;To do that math in Splunk, just add something like ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| rex field=clientip "(?&amp;lt;octet1&amp;gt;\d{1,3}).(?&amp;lt;octet2&amp;gt;\d{1,3}).(?&amp;lt;octet3&amp;gt;\d{1,3}).(?&amp;lt;octet4&amp;gt;\d{1,3})" |eval ip_decimal=(octet1*16777216)+(octet2*65536)+(octet3*256)+octet4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the search.  Obviously fix "clientip" to your IP field.  This will create a field "ip_decimal" which will match your ranges.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 19:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/loop-search-for-ranges-mapping/m-p/181348#M44798</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2014-08-14T19:48:32Z</dc:date>
    </item>
  </channel>
</rss>

