<?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: How to search across all my data for any public IP addresses? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200857#M58242</link>
    <description>&lt;P&gt;Maybe the regex's below might help in being more specific to just public ranges?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"172.(1[6-9].|2[0-9].|3[0-1].)[0-9]{1,3}.[0-9]{1,3}"

"(10.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Maybe that might find some matches for your initial regex against _raw events.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2016 14:57:54 GMT</pubDate>
    <dc:creator>pgreer_splunk</dc:creator>
    <dc:date>2016-06-27T14:57:54Z</dc:date>
    <item>
      <title>How to search across all my data for any public IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200856#M58241</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I've been hoping to play around with some of the &lt;CODE&gt;iplocation&lt;/CODE&gt; functionality and see if I could leverage it somehow, so I rooted around and found that most of my data is private addresses. That was to be expected, but as I dig around, I cannot seem to find any public addresses at all.&lt;/P&gt;

&lt;P&gt;From there I thought it would be fairly simple to do a search across all my data for any public address, or at the very least any non-private (weed out the smaller set). It turns out that I cannot find an easy way of doing this. Regex sounds like it would be a good approach, but that alone as proven to be more complex than expected.&lt;/P&gt;

&lt;P&gt;Since I'm looking to find a public IP in &lt;EM&gt;any&lt;/EM&gt; location, which means I'm not specifying a source, sourcetype, or field. So I'm either using _raw with regex or &lt;CODE&gt;index=*&lt;/CODE&gt; searches for IP addresses. Without regex, it becomes a bit of a bear because doing a NOT search without specifying a field (which I do not know) removes the whole event, which may also contain a public address.&lt;/P&gt;

&lt;P&gt;I've found a couple regex online that match RFC 1918 addresses, but most use the /m flag in regex101 (m modifier: multi-line. Causes ^ and $ to match the begin/end of each line) which it looks like splunk does not use.&lt;/P&gt;

&lt;P&gt;I'm currently using this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*| regex _raw="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | search src_ip!=10.* src_ip!=127.* src_ip!=172.16.* src_ip!=::ffff:10* src_ip.!=::ffff:127.* src_ip!=::fff:172.16.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally I'd not have to specify a field, as I said previously, but my current approach is to pair down the data with specific qualifiers until I either find what I'm looking for or run out of data.&lt;/P&gt;

&lt;P&gt;I very well may not have any public addresses in the data I'm using! &lt;/P&gt;

&lt;P&gt;Any suggestions for this problem?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 14:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200856#M58241</guid>
      <dc:creator>j4adam</dc:creator>
      <dc:date>2016-06-08T14:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to search across all my data for any public IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200857#M58242</link>
      <description>&lt;P&gt;Maybe the regex's below might help in being more specific to just public ranges?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"172.(1[6-9].|2[0-9].|3[0-1].)[0-9]{1,3}.[0-9]{1,3}"

"(10.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Maybe that might find some matches for your initial regex against _raw events.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 14:57:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200857#M58242</guid>
      <dc:creator>pgreer_splunk</dc:creator>
      <dc:date>2016-06-27T14:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to search across all my data for any public IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200858#M58243</link>
      <description>&lt;P&gt;Just adding to pgreer's answer&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval ip_list="172.16.20.1,10.1.1.1,192.168.1.1,1.2.3.4,127.0.0.1,169.254.20.10"
| makemv ip_list delim="," 
| mvexpand ip_list
| eval ip_type = case(match('ip_list',"172.(1[6-9].|2[0-9].|3[0-1].)[0-9]{1,3}.[0-9]{1,3}"),"1_private",match('ip_list',"(10.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})"),"1_private",match('ip_list',"(192.168.[0-9]{1,3}.[0-9]{1,3})"),"1_private",match('ip_list',"(127.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})"),"3_loopback",match('ip_list',"(169.254.[0-9]{1,3}.[0-9]{1,3})"),"2_apipa",1=1,"0_public")
| sort ip_type ip_list
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Oct 2019 14:22:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/200858#M58243</guid>
      <dc:creator>dkadavis</dc:creator>
      <dc:date>2019-10-18T14:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to search across all my data for any public IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/611733#M212678</link>
      <description>&lt;P&gt;This looks really nice!&lt;/P&gt;&lt;P&gt;How would I populate "ip_list" with output from my own "base search"? Or do some direct pipe to eval?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 10:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-across-all-my-data-for-any-public-IP-addresses/m-p/611733#M212678</guid>
      <dc:creator>fatsug</dc:creator>
      <dc:date>2022-09-02T10:17:11Z</dc:date>
    </item>
  </channel>
</rss>

