<?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 How to match an ip address to cidr in lookup table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565640#M197095</link>
    <description>&lt;P&gt;Hey there Splunk hero's,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Story/Background:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So, there is this variable called "src_ip" in my correlation search. The "src_ip" is a more than 5000+ ip address.&lt;/P&gt;
&lt;P&gt;What i am doing is matching these ip address which should not be in a particular CIDR range using cidrmatch function which works prefectly.&lt;/P&gt;
&lt;P&gt;Which looks something like this :&lt;/P&gt;
&lt;P&gt;| where (NOT cidrmatch("34.20.223.128/25",src_ip) AND NOT cidrmatch("13.9.22.0/25",src_ip) AND NOT cidrmatch("13.56.21.18/25",src_ip) AND NOT cidrmatch("35.17.29.0/26",src_ip) AND NOT(many-more,src_ip))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SOLUTION REQUIRED:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now, coming to the part where i need your help is .&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I want to simply this.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;SOLUTION Tried:&lt;BR /&gt;&lt;/STRONG&gt;PART 1:&lt;BR /&gt;Solutions which i have searched over the forum tell me to create a lookup table and look through it.&lt;/P&gt;
&lt;P&gt;So, I have created a lookup table named "match_cidr.csv". This csv/lookup file consist of more that 100+ CIDR blocks under a variable called cidr_match_src_ip.&lt;BR /&gt;&lt;BR /&gt;What i have tried looking into this via this command. there is a tstat command as well so,&lt;/P&gt;
&lt;P&gt;Query looks like this&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;[ | inputlookup match_cidr.csv | where src_ip != cidr_match_src_ip] ===&amp;gt; this won't work since i am comparing a CIDR to IP address directly.&lt;BR /&gt;&lt;BR /&gt;where NOT cidrmatch([| inputlookup match_cidr.csv], src) ==&amp;gt; tried this as well&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;What can i use here or what other things can you recommend me to do. Feel free to ask any more question to me if my message isn't clear&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 20:39:22 GMT</pubDate>
    <dc:creator>commanman</dc:creator>
    <dc:date>2023-01-12T20:39:22Z</dc:date>
    <item>
      <title>How to match an ip address to cidr in lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565640#M197095</link>
      <description>&lt;P&gt;Hey there Splunk hero's,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Story/Background:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So, there is this variable called "src_ip" in my correlation search. The "src_ip" is a more than 5000+ ip address.&lt;/P&gt;
&lt;P&gt;What i am doing is matching these ip address which should not be in a particular CIDR range using cidrmatch function which works prefectly.&lt;/P&gt;
&lt;P&gt;Which looks something like this :&lt;/P&gt;
&lt;P&gt;| where (NOT cidrmatch("34.20.223.128/25",src_ip) AND NOT cidrmatch("13.9.22.0/25",src_ip) AND NOT cidrmatch("13.56.21.18/25",src_ip) AND NOT cidrmatch("35.17.29.0/26",src_ip) AND NOT(many-more,src_ip))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SOLUTION REQUIRED:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now, coming to the part where i need your help is .&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I want to simply this.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;SOLUTION Tried:&lt;BR /&gt;&lt;/STRONG&gt;PART 1:&lt;BR /&gt;Solutions which i have searched over the forum tell me to create a lookup table and look through it.&lt;/P&gt;
&lt;P&gt;So, I have created a lookup table named "match_cidr.csv". This csv/lookup file consist of more that 100+ CIDR blocks under a variable called cidr_match_src_ip.&lt;BR /&gt;&lt;BR /&gt;What i have tried looking into this via this command. there is a tstat command as well so,&lt;/P&gt;
&lt;P&gt;Query looks like this&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;[ | inputlookup match_cidr.csv | where src_ip != cidr_match_src_ip] ===&amp;gt; this won't work since i am comparing a CIDR to IP address directly.&lt;BR /&gt;&lt;BR /&gt;where NOT cidrmatch([| inputlookup match_cidr.csv], src) ==&amp;gt; tried this as well&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;What can i use here or what other things can you recommend me to do. Feel free to ask any more question to me if my message isn't clear&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 20:39:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565640#M197095</guid>
      <dc:creator>commanman</dc:creator>
      <dc:date>2023-01-12T20:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565696#M197110</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238004"&gt;@commanman&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Problem is that when you put CIDR blocks directly in a search, it gets treated a string, not a CIDR. Hence it never matches with the IP addresses.&lt;/P&gt;&lt;P&gt;To resolve this, you can try the following with your lookup, that you have created:&lt;/P&gt;&lt;P&gt;Go to settings -&amp;gt; lookups -&amp;gt; lookup definitions and see if a definition for your lookup exists or not (It should, cos that's required to make it available for searching.). If not there, then please create one.&lt;/P&gt;&lt;P&gt;In the definition for your lookup, open it and click Advanced options and under Match Type, Please enter the following and click save.&lt;/P&gt;&lt;P&gt;CIDR(&lt;SPAN&gt;cidr_match_src_ip)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Then try the following:&lt;/P&gt;&lt;P&gt;| Your base search&lt;/P&gt;&lt;P&gt;| search NOT [| inputlookup your_lookup_name.csv | rename cidr_match_src_ip as src_ip | fields src_ip]&lt;/P&gt;&lt;P&gt;| Rest of your query.&lt;/P&gt;&lt;P&gt;Let me know if it helps.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***If this helped, please accept it as a solution. It helps others to find the solution for similar issues quickly.***&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 16:31:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565696#M197110</guid>
      <dc:creator>shivanshu1593</dc:creator>
      <dc:date>2021-09-02T16:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565885#M197173</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/61125"&gt;@shivanshu1593&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As you suggested,&lt;/P&gt;&lt;P&gt;What I have a tried is this:&lt;BR /&gt;&lt;BR /&gt;Here is my correlation search:&lt;BR /&gt;&lt;BR /&gt;| tstats summariesonly=true allow_old_summaries=true values(IDS_Attacks.dest) as "dest" dc(IDS_Attacks.dest) as "count" values(IDS_Attacks.signature) as signature from datamodel="Intrusion_Detection"."IDS_Attacks" where IDS_Attacks.severity!="informational" by "IDS_Attacks.src" "IDS_Attacks.severity"&lt;BR /&gt;&lt;BR /&gt;| rename "IDS_Attacks.src" as "src" "IDS_Attacks.severity" as severity&lt;BR /&gt;&lt;BR /&gt;| where 'count'&amp;gt;25&lt;BR /&gt;&lt;BR /&gt;| search (src!=10.161.35.50 AND src!=161.16.157.154 AND src!=161.16.155.105 AND src!=161.16.156.118 AND src!=165.249.145.180 AND src!=10.160.8.170 AND src!=10.160.8.171 AND src!=10.160.8.172 AND src!=10.160.8.173 AND src!=10.172.8.170 AND src!=10.172.8.171)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//Part where in want to input a lookup table&lt;/STRONG&gt;&lt;BR /&gt;| where ( NOT cidrmatch("13.59.252.0/25",src) AND NOT cidrmatch("13.56.21.128/25",src) AND NOT cidrmatch("35.177.219.0/26",src) AND NOT cidrmatch("13.210.1.64/26",src) AND NOT cidrmatch("54.175.125.192/26",src) AND NOT cidrmatch("54.219.188.128/26",src) AND NOT cidrmatch("54.93.254.128/26",src) AND NOT cidrmatch("54.255.254.0/26",src) AND NOT cidrmatch("10.161.69.43/32",src) AND NOT cidrmatch("10.161.69.44/32",src) AND NOT cidrmatch("161.16.157.80/32",src) AND NOT cidrmatch("161.16.157.64/32",src) AND NOT cidrmatch("161.16.157.138/32",src) AND NOT cidrmatch("161.16.157.213/32",src) AND NOT cidrmatch("161.16.157.216/32",src))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So here i have created a lookup table having all the CIDR BLOCKS&amp;nbsp; in a excel with .csv extension.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STEP1:&lt;BR /&gt;&lt;BR /&gt;My excel file looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_1-1630725490754.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15836i7D2E53967524534D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_1-1630725490754.png" alt="commanman_1-1630725490754.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 2:&lt;/P&gt;&lt;P&gt;Now I have converted this to .csv file&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_2-1630725490756.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15837iDB5346CBC8EED441/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_2-1630725490756.png" alt="commanman_2-1630725490756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step3:&lt;/P&gt;&lt;P&gt;Uploaded in lookup table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_3-1630725490760.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15838iBD86AD40736031F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_3-1630725490760.png" alt="commanman_3-1630725490760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 4:&lt;BR /&gt;Checking if file uploaded successfully:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_4-1630725490765.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15839i9701610A757E963A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_4-1630725490765.png" alt="commanman_4-1630725490765.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 5:&lt;/P&gt;&lt;P&gt;Created a lookup definition as you suggested&lt;/P&gt;&lt;P&gt;Go to settings -&amp;gt; lookups -&amp;gt; lookup definitions and see if a definition for your lookup exists or not (It should, cos that's required to make it available for searching.). If not there, then please create one.&lt;/P&gt;&lt;P&gt;In the definition for your lookup, open it and click Advanced options and under Match Type, Please enter the following and click save.&lt;/P&gt;&lt;P&gt;CIDR(cidr_match_src_ip) =è mine would be CIDR(CIDR) I have reduced the complexity let me know if this wrong or not.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_5-1630725490773.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15841iF855609F2AA0B5CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_5-1630725490773.png" alt="commanman_5-1630725490773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Step 6:&lt;BR /&gt;Now checking if it has been successfully created&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_6-1630725490775.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15840iE2AE9627D70C1D4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_6-1630725490775.png" alt="commanman_6-1630725490775.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 7:&lt;/P&gt;&lt;P&gt;Now that every thing is in place lets run this query.&lt;/P&gt;&lt;P&gt;| Your base search&lt;/P&gt;&lt;P&gt;| search NOT [| inputlookup your_lookup_name.csv | rename cidr_match_src_ip as src_ip | fields src_ip]&lt;/P&gt;&lt;P&gt;| Rest of your query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;==================MY QUERY ++++++++++++++++++++++++++++++++&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| tstats summariesonly=true allow_old_summaries=true values(IDS_Attacks.dest) as "dest" dc(IDS_Attacks.dest) as "count" values(IDS_Attacks.signature) as signature from datamodel="Intrusion_Detection"."IDS_Attacks" where IDS_Attacks.severity!="informational" by "IDS_Attacks.src" "IDS_Attacks.severity"&lt;BR /&gt;&lt;BR /&gt;| rename "IDS_Attacks.src" as "src" "IDS_Attacks.severity" as severity&lt;BR /&gt;&lt;BR /&gt;| where 'count'&amp;gt;25&lt;BR /&gt;&lt;BR /&gt;| search (src!=10.161.35.50 AND src!=161.16.157.154 AND src!=161.16.155.105 AND src!=161.16.156.118 AND src!=165.249.145.180 AND src!=10.160.8.170 AND src!=10.160.8.171 AND src!=10.160.8.172 AND src!=10.160.8.173 AND src!=10.172.8.170 AND src!=10.172.8.171)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//Part where in will insert our methodology&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&lt;STRONG&gt;| search NOT [ | inputlookup cidr.csv | rename CIDR as src | fields src ]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;This does not works.&lt;/P&gt;&lt;P&gt;ERROR I AM FACING ARE:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_7-1630725490776.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15842iC5E8D448FFDC4443/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_7-1630725490776.png" alt="commanman_7-1630725490776.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commanman_8-1630725490776.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15843i9389D15A750FE759/image-size/medium?v=v2&amp;amp;px=400" role="button" title="commanman_8-1630725490776.png" alt="commanman_8-1630725490776.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output stats is also not correct.&lt;BR /&gt;&lt;BR /&gt;If you could correct me where I am wrong would be great.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;@commonman&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 03:20:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/565885#M197173</guid>
      <dc:creator>commanman</dc:creator>
      <dc:date>2021-09-04T03:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626976#M217893</link>
      <description>&lt;P&gt;Where did you end up with this?&lt;/P&gt;&lt;P&gt;I'm having issues as well but my errors are that my tstats search doesn't seem to like searching for src IPs that are CIDRs.&amp;nbsp; When I use a lookup table full of regular IP addresses, I get results but when I use a lookup table full of CIDR addresses I don't get any results despite having created the lookup definition and such.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 20:36:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626976#M217893</guid>
      <dc:creator>sjbriggs</dc:creator>
      <dc:date>2023-01-12T20:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626977#M217894</link>
      <description>&lt;P&gt;Just for the record - it is not true.&lt;/P&gt;&lt;P&gt;A run-anywhere example showing that search by CIDR ranges work&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval ip=split("192.168.1.12,172.16.0.1,10.0.0.1",",")&lt;BR /&gt;| mvexpand ip&lt;BR /&gt;| search ip IN (192.168.0.0/16,10.0.0.0/8)&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626977#M217894</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-01-12T21:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626979#M217896</link>
      <description>&lt;P&gt;Most probably nowhere, judging from lack of accepted solution and a generally dead thread.&lt;/P&gt;&lt;P&gt;You'll probably have a better chance of reasonable response if you create a new thread with verbose description of what you have, what you want to achieve and what you tried so far.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:04:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626979#M217896</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-01-12T21:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626980#M217897</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've never had a problem with CIDR based searches in the past.&amp;nbsp; I seem to be stumbling when doing a CIDR search involving TSTATS.&amp;nbsp; I'm pulling proxy metrics based on src addresses using tstats and then attempting to limit those results to subnets listed in a lookup table and not successful at all.&amp;nbsp; The example code below works fine when my "serverlist" lookup table has individual IP addreses but returns nothing when I have CIDR addresses despite the fact that I have the lookup definition defined.&amp;nbsp; Again, i've done CIDR based lookups a ton and never had an issue but haven't done it with TSTATS before.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| tstats sum(proxy_metrics.bytes_in) AS TotalBytesIN sum(proxy_metrics.bytes_out) AS TotalBytesOUT from datamodel=proxy_stats BY proxy_metrics.src&lt;BR /&gt;| search [| inputlookup serverlist&lt;BR /&gt;| rename subnet AS proxy_metrics.src&lt;BR /&gt;| fields proxy_metrics.src]&lt;BR /&gt;| stats sum(TotalBytesIN) AS TotalBytesIN sum(TotalBytesOUT) AS TotalBytesOUT&amp;nbsp; BY proxy_metrics.src&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:11:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626980#M217897</guid>
      <dc:creator>sjbriggs</dc:creator>
      <dc:date>2023-01-12T21:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626986#M217901</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recreated my lookup definition and it seems to be working now so disregard my earlier message.&amp;nbsp; &amp;nbsp;Not sure what happened there but at least it seems to be doing what I want now.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 22:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/626986#M217901</guid>
      <dc:creator>sjbriggs</dc:creator>
      <dc:date>2023-01-12T22:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to match an ip address to cidr in lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/627050#M217925</link>
      <description>&lt;P&gt;The problem is in your query (and possibly your lookup definition). &amp;nbsp;Generally speaking, using inputlookup as subsearch is not a solution in cases where you really mean a lookup match.&lt;/P&gt;&lt;P&gt;Splunk's lookup definition allows you to specify match type, one of them is CIDR. &amp;nbsp;You'll need to check "Advanced options" to add it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lookup-cidr.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23358i702D9FE8C3A22EDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="lookup-cidr.png" alt="lookup-cidr.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Suppose your file&amp;nbsp;&lt;SPAN&gt;match_cidr.csv contains the following&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" width="64.64449179292929%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="32.82828282828283%" height="25px"&gt;subnet&lt;/TD&gt;&lt;TD width="31.81818181818182%" height="25px"&gt;known_network&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="32.82828282828283%" height="25px"&gt;10.100.0.0/16&lt;/TD&gt;&lt;TD width="31.81818181818182%" height="25px"&gt;mine&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="32.82828282828283%" height="25px"&gt;10.16.5.0/24&lt;/TD&gt;&lt;TD width="31.81818181818182%" height="25px"&gt;friends&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.16.205.0/24&lt;/TD&gt;&lt;TD&gt;enemies&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;and the lookup name is also &lt;SPAN&gt;match_cidr.csv. &amp;nbsp;Instead of inputlookup, the correct command is &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup#lookup" target="_blank" rel="noopener"&gt;lookup&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup match_cidr.csv subnet AS src_ip
| where isnull(known_network)&lt;/LI-CODE&gt;&lt;P&gt;This will find all src_ip's that are not your own, not your friends', and not your known enemies'.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 09:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-an-ip-address-to-cidr-in-lookup-table/m-p/627050#M217925</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-01-13T09:51:17Z</dc:date>
    </item>
  </channel>
</rss>

