<?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 Sub-Domain Count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88891#M22751</link>
    <description>&lt;P&gt;I am looking to pull all domains from dns logs and get a count of how many unique sub-domains that were requested of that domain.&lt;/P&gt;

&lt;P&gt;This is what I have so far. I might be going in the wrong direction so if I need to wipe and retry I ok with that.&lt;/P&gt;

&lt;P&gt;index=dns | rex field=named_domain "(?&lt;DOMAIN&gt;([^.]+.)?[^.]+$)" | stats count by named_domain | uniq | table domain, count&lt;/DOMAIN&gt;&lt;/P&gt;

&lt;P&gt;My problem is that the count is not the count of the unique sub-domains but instead of I am getting all sub-domains grouped with the domain field.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:00:53 GMT</pubDate>
    <dc:creator>queme</dc:creator>
    <dc:date>2020-09-28T12:00:53Z</dc:date>
    <item>
      <title>Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88891#M22751</link>
      <description>&lt;P&gt;I am looking to pull all domains from dns logs and get a count of how many unique sub-domains that were requested of that domain.&lt;/P&gt;

&lt;P&gt;This is what I have so far. I might be going in the wrong direction so if I need to wipe and retry I ok with that.&lt;/P&gt;

&lt;P&gt;index=dns | rex field=named_domain "(?&lt;DOMAIN&gt;([^.]+.)?[^.]+$)" | stats count by named_domain | uniq | table domain, count&lt;/DOMAIN&gt;&lt;/P&gt;

&lt;P&gt;My problem is that the count is not the count of the unique sub-domains but instead of I am getting all sub-domains grouped with the domain field.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:00:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88891#M22751</guid>
      <dc:creator>queme</dc:creator>
      <dc:date>2020-09-28T12:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88892#M22752</link>
      <description>&lt;P&gt;Your rex statement reads "look inside the field called 'named_domain' and capture &amp;lt;something DOT something&amp;gt;, and store the results in a field called 'domain'."  Your stats call then sums over the original field named_domain; I suspect you're just dealing with a typo.&lt;/P&gt;

&lt;P&gt;If I've missed the mark, maybe you could provide a couple samples lines (enough to spot a pattern) and the desired output?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 02:08:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88892#M22752</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-07-03T02:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88893#M22753</link>
      <description>&lt;P&gt;Jul  3 02:19:31 query from IP: 1.1.1.1 Port#49335: Name: tap-cdn.rubiconproject.com. Destination: 2.2.2.2 Time: Jul  3 02:19:31&lt;/P&gt;

&lt;P&gt;Jul  3 02:19:31 query from IP: 1.1.1.1 Port#65260: Name: api.echoenabled.com. Destination: 2.2.2.2 Time: Jul  3 02:19:31&lt;/P&gt;

&lt;P&gt;Jul  3 02:20:56 query from IP: 1.1.1.1 Port#64937: Name: versatables-com.amazonwebstore.com. Destination: 2.2.2.2 Time: Jul  3 02:19:31&lt;/P&gt;

&lt;P&gt;I changed the Ips for security reasons.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 02:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88893#M22753</guid>
      <dc:creator>queme</dc:creator>
      <dc:date>2012-07-03T02:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88894#M22754</link>
      <description>&lt;P&gt;The name_domain field contains the entire domain (tap-cdn.rubiconproject.com) and my rex field will pull from that and show just rubiconproject.com. (I found this in one of the answers and it works well) My problem is if there are 100 logs with a request to tap-cdn.rubiconproject.com it will show a count of 100.  only want to see 1. If there is another sub-domain tap1-cdn.rubiconproject and tap-cdn.rubiconproject I want it to show 2. &lt;/P&gt;

&lt;P&gt;What I want it to look like:&lt;/P&gt;

&lt;P&gt;Domain         |    # of Sub-Domains&lt;BR /&gt;
Facebook.com                 12&lt;BR /&gt;
abc.com                       2&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 02:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88894#M22754</guid>
      <dc:creator>queme</dc:creator>
      <dc:date>2012-07-03T02:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88895#M22755</link>
      <description>&lt;P&gt;Perhaps &lt;CODE&gt;stats distinct_count(name_domain) by domain&lt;/CODE&gt; is what you're looking for?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88895#M22755</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2020-09-28T12:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Domain Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88896#M22756</link>
      <description>&lt;P&gt;That worked great, thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 19:42:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sub-Domain-Count/m-p/88896#M22756</guid>
      <dc:creator>queme</dc:creator>
      <dc:date>2012-07-03T19:42:29Z</dc:date>
    </item>
  </channel>
</rss>

