<?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 When searching for IP, how to only show the subnet, not the whole IP in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/When-searching-for-IP-how-to-only-show-the-subnet-not-the-whole/m-p/654512#M226135</link>
    <description>&lt;P&gt;I have this search&lt;/P&gt;&lt;PRE&gt;index="firewall" dest_ip=172.99.99.99 dest_port=* | stats count by src_ip,dest_port,action,src_user&lt;/PRE&gt;&lt;P&gt;Instead of showing all src_ip's I want to group on the subnet part, that is using the dest_ip as an example, the three first (not being a network guy I might use the wrong wording &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ) in the stats&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;172.99.99&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;My guess is rex, but guessing that there might be some other easier functions in Splunk for doing this?&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2023 15:16:11 GMT</pubDate>
    <dc:creator>rune_hellem</dc:creator>
    <dc:date>2023-08-16T15:16:11Z</dc:date>
    <item>
      <title>When searching for IP, how to only show the subnet, not the whole IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-searching-for-IP-how-to-only-show-the-subnet-not-the-whole/m-p/654512#M226135</link>
      <description>&lt;P&gt;I have this search&lt;/P&gt;&lt;PRE&gt;index="firewall" dest_ip=172.99.99.99 dest_port=* | stats count by src_ip,dest_port,action,src_user&lt;/PRE&gt;&lt;P&gt;Instead of showing all src_ip's I want to group on the subnet part, that is using the dest_ip as an example, the three first (not being a network guy I might use the wrong wording &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ) in the stats&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;172.99.99&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;My guess is rex, but guessing that there might be some other easier functions in Splunk for doing this?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 15:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-searching-for-IP-how-to-only-show-the-subnet-not-the-whole/m-p/654512#M226135</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2023-08-16T15:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: When searching for IP, how to only show the subnet, not the whole IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-searching-for-IP-how-to-only-show-the-subnet-not-the-whole/m-p/654519#M226137</link>
      <description>&lt;P&gt;If you know your subnet is 24 bits i.e. the first 3 numbers of an IPv4 address x.x.x.y, you could do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="firewall" dest_ip=172.99.99.99 dest_port=* 
| rex field=dest_ip "(?&amp;lt;dest_ip_subnet&amp;gt;^.*)\.\d+$"
| stats count by src_ip,dest_port,dest_ip_subnet,action,src_user&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Aug 2023 15:58:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-searching-for-IP-how-to-only-show-the-subnet-not-the-whole/m-p/654519#M226137</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-16T15:58:19Z</dc:date>
    </item>
  </channel>
</rss>

