<?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 IP address in Splunk to IP range in CSV in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332165#M98818</link>
    <description>&lt;P&gt;The best way to do this is to configure your lookup table to perform CIDR matching. Here is a good example of how to do that:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/305211/how-to-match-an-ip-address-from-a-lookup-table-of.html"&gt;https://answers.splunk.com/answers/305211/how-to-match-an-ip-address-from-a-lookup-table-of.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This will allow you to just use &lt;CODE&gt;| lookup ip_address...&lt;/CODE&gt; like normal, but it will use CIDR matching under the hood.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 22:24:47 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2017-12-08T22:24:47Z</dc:date>
    <item>
      <title>Match IP address in Splunk to IP range in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332164#M98817</link>
      <description>&lt;P&gt;index=logs ip_address=*&lt;BR /&gt;
has single ip addresses like 5.9.100.100 &lt;/P&gt;

&lt;P&gt;CSV file:&lt;BR /&gt;
range, owner&lt;BR /&gt;
5.9.0.0/24 Owner1&lt;BR /&gt;
5.10.64.0/24 Owner2&lt;/P&gt;

&lt;P&gt;How can I correlate ip_address to CIDR in CSV file?&lt;/P&gt;

&lt;P&gt;I guess we need to use CIDR_match and input lookup function somewhere.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 20:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332164#M98817</guid>
      <dc:creator>spark2310</dc:creator>
      <dc:date>2017-12-08T20:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Match IP address in Splunk to IP range in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332165#M98818</link>
      <description>&lt;P&gt;The best way to do this is to configure your lookup table to perform CIDR matching. Here is a good example of how to do that:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/305211/how-to-match-an-ip-address-from-a-lookup-table-of.html"&gt;https://answers.splunk.com/answers/305211/how-to-match-an-ip-address-from-a-lookup-table-of.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This will allow you to just use &lt;CODE&gt;| lookup ip_address...&lt;/CODE&gt; like normal, but it will use CIDR matching under the hood.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 22:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332165#M98818</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-12-08T22:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Match IP address in Splunk to IP range in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332166#M98819</link>
      <description>&lt;P&gt;so how would you rewrite my query?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 22:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332166#M98819</guid>
      <dc:creator>spark2310</dc:creator>
      <dc:date>2017-12-08T22:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Match IP address in Splunk to IP range in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332167#M98820</link>
      <description>&lt;P&gt;After you've configured your lookup to use CIDR matching, let's say you called your lookup &lt;CODE&gt;ip_owner&lt;/CODE&gt;. If you have a base search already and just want to retain the events from your search that match the CIDRs in the lookup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| lookup ip_owner range AS ip_address OUTPUT owner
| where isnotnull(owner)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Dec 2017 04:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332167#M98820</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-12-09T04:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Match IP address in Splunk to IP range in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332168#M98821</link>
      <description>&lt;P&gt;Run this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval raw="5.9.0.0/24 Owner1::5.10.64.0/24 Owner2
| makemv delim="::" raw
| mvexpand raw
| rex field=raw"^(?&amp;lt;range&amp;gt;\S+)\s+(?&amp;lt;owner&amp;gt;.*)$"
| table range owner
| outputlookup MyLookup.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You now have a &lt;CODE&gt;Lookup file&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Create a &lt;CODE&gt;Lookup definition&lt;/CODE&gt; like this:&lt;BR /&gt;
&lt;CODE&gt;Settings&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Lookups&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Lookup definitions&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;New&lt;/CODE&gt;&lt;BR /&gt;
Give it a name like &lt;CODE&gt;MyLookup&lt;/CODE&gt; and select &lt;CODE&gt;File-based&lt;/CODE&gt; for &lt;CODE&gt;Type&lt;/CODE&gt; and &lt;CODE&gt;MyLookup.csv&lt;/CODE&gt; for &lt;CODE&gt;Lookup file&lt;/CODE&gt;.&lt;BR /&gt;
Click &lt;CODE&gt;Advanced options&lt;/CODE&gt; checkbox.&lt;BR /&gt;
Enter &lt;CODE&gt;CIDR(range)&lt;/CODE&gt; for &lt;CODE&gt;Match type&lt;/CODE&gt;.&lt;BR /&gt;
Click thegreen &lt;CODE&gt;Save&lt;/CODE&gt; button.&lt;BR /&gt;
You now have a &lt;CODE&gt;Lookup definition&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Create an &lt;CODE&gt;Automatic lookup&lt;/CODE&gt; like this:&lt;BR /&gt;
&lt;CODE&gt;Settings&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Lookups&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Automatic lookups&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;New&lt;/CODE&gt;&lt;BR /&gt;
Give it a name like &lt;CODE&gt;MyLookup_ip_address_TO_owner&lt;/CODE&gt;.&lt;BR /&gt;
Select &lt;CODE&gt;MyLookup&lt;/CODE&gt; for &lt;CODE&gt;Lookup table&lt;/CODE&gt; (&lt;EM&gt;yes&lt;/EM&gt;, it is mislabeled).&lt;BR /&gt;
Enter your &lt;CODE&gt;sourcetype&lt;/CODE&gt; for &lt;CODE&gt;Named&lt;/CODE&gt;.&lt;BR /&gt;
Enter &lt;CODE&gt;range&lt;/CODE&gt; on the left and &lt;CODE&gt;ip_address&lt;/CODE&gt; on the right under &lt;CODE&gt;Lookup input fields&lt;/CODE&gt;.&lt;BR /&gt;
Enter &lt;CODE&gt;owner&lt;/CODE&gt; on the left under &lt;CODE&gt;Lookup output fields&lt;/CODE&gt;&lt;BR /&gt;
Check (or not) the &lt;CODE&gt;Overwrite field values&lt;/CODE&gt; box.&lt;BR /&gt;
Click the green &lt;CODE&gt;Save&lt;/CODE&gt; button.&lt;BR /&gt;
You now have an &lt;CODE&gt;Automatic lookup&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Wait 10 minutes.&lt;BR /&gt;
PROFIT!&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 05:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-IP-address-in-Splunk-to-IP-range-in-CSV/m-p/332168#M98821</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-09T05:05:17Z</dc:date>
    </item>
  </channel>
</rss>

