<?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: Report with multi level domain in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54707#M13346</link>
    <description>&lt;P&gt;Thanks I will test that out at the same time I'm thinking of using the collect command together with more granular tagging to differentiate the different types of domains(2/3/4 level) and throwing them into different indexes applying different regular expressions to pull out the wanted domains (in different indexes).&lt;/P&gt;

&lt;P&gt;The difficulty is to find out which domain is suppose to be 2/3/4 level as these are all human defined.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2010 23:17:35 GMT</pubDate>
    <dc:creator>manwin</dc:creator>
    <dc:date>2010-09-21T23:17:35Z</dc:date>
    <item>
      <title>Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54702#M13341</link>
      <description>&lt;P&gt;Background&lt;/P&gt;

&lt;P&gt;Creating a listing of bad domains based on 2/3/4 levels of a url&lt;/P&gt;

&lt;P&gt;Here's the sample list which I created using Eventtypes&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Bad_Domain_Red]
search = sourcetype="bcoat_proxysg" dest_host="*2o7.net" OR dest_host="*123.ddns.org"

[Bad_Domain_Orange]
search = sourcetype="bcoat_proxysg" dest_host="*abc.net"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Upon creating the event type above.&lt;/P&gt;

&lt;P&gt;The results which will appear with the tags&lt;/P&gt;

&lt;P&gt;e.g.: -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" eventtype="Bad_Domain_Red"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;/P&gt;

&lt;P&gt;1) dest_host=abc.2o7.net&lt;/P&gt;

&lt;P&gt;2) dest_host=splunk.2o7.net&lt;/P&gt;

&lt;P&gt;3) dest_host=manwin.2o7.net&lt;/P&gt;

&lt;P&gt;4) myportal.123.ddns.org&lt;/P&gt;

&lt;P&gt;5) yourportal.123.ddns.org&lt;/P&gt;

&lt;P&gt;etc etc&lt;/P&gt;

&lt;P&gt;When I want to create a report of counts based on these domains I'm not able to due to the multi levels.&lt;/P&gt;

&lt;P&gt;I'm trying to create a report showing &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dest_host      Count    
2o7.net        50
123.ddns.org   100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see above it is suppose to consolidate the counts for sub domains i.e. abc.2o7.net,splunk.2o7.net etc into 2o7.net&lt;/P&gt;

&lt;P&gt;Is there anyway to do it?
I have about 200 different domains split into 4 different categories based on color coding red,orange,yellow,green.&lt;/P&gt;

&lt;P&gt;Some are monitored at the 2nd level while others are monitored at 3rd or 4th level.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 21:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54702#M13341</guid>
      <dc:creator>manwin</dc:creator>
      <dc:date>2010-09-21T21:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54703#M13342</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;rex&lt;/CODE&gt; to extract a new field containing the second-level domain, and run your report based on that.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" eventtype="Bad_Domain_Red" | rex field=hostname "(?&amp;lt;xdomain&amp;gt;([^\.]+.)?[^\.]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should pull out a new field named &lt;CODE&gt;xdomain&lt;/CODE&gt; which will contain the top two levels. The second-level domain will be optional, in case of unqualified names.&lt;/P&gt;

&lt;P&gt;If you want something fancier, this might work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=hostname "((?&amp;lt;xhost&amp;gt;[^\.]+)\.)?(?&amp;lt;xdomain&amp;gt;(([^\.]+\.)+)?[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For hostnames with only one or two components/segments, &lt;CODE&gt;xdomain&lt;/CODE&gt; will contain the entire string. When there are at least three components in the name, the first will go into &lt;CODE&gt;xhost&lt;/CODE&gt; and &lt;CODE&gt;xdomain&lt;/CODE&gt; will contain everything else.&lt;/P&gt;

&lt;P&gt;It works because the plus sign at the end of the the &lt;CODE&gt;([^\.]+\.)+&lt;/CODE&gt; section makes it greedy, causing the regex engine to backtrack to find a match, even if it has to steal the text from the initial (non-greedy) match on &lt;CODE&gt;(?&amp;lt;xhost&amp;gt;[^\.]+)\.)?&lt;/CODE&gt;  It's worth noting that backtracking can be &lt;I&gt;really&lt;/I&gt; bad for regex performance, so this isn't ideal. It can probably be cleaned up with more effort, but should get you going.&lt;/P&gt;

&lt;P&gt;See also - &lt;A href="http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Rex" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 22:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54703#M13342</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-21T22:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54704#M13343</link>
      <description>&lt;P&gt;Thanks I've tried that but however the challenge is that some of these domains are 2 levels while some are 3 or 4 levels.&lt;BR /&gt;
That's where I'm having the problem......&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 22:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54704#M13343</guid>
      <dc:creator>manwin</dc:creator>
      <dc:date>2010-09-21T22:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54705#M13344</link>
      <description>&lt;P&gt;As in my example, where I'm looking at reports which may include both.&lt;BR /&gt;
The need for identifying 3 level domains is because of domains coming from dynamic DNS.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 22:11:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54705#M13344</guid>
      <dc:creator>manwin</dc:creator>
      <dc:date>2010-09-21T22:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54706#M13345</link>
      <description>&lt;P&gt;Ah, now I understand. Answer edited above, it's more readable there.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 22:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54706#M13345</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-21T22:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54707#M13346</link>
      <description>&lt;P&gt;Thanks I will test that out at the same time I'm thinking of using the collect command together with more granular tagging to differentiate the different types of domains(2/3/4 level) and throwing them into different indexes applying different regular expressions to pull out the wanted domains (in different indexes).&lt;/P&gt;

&lt;P&gt;The difficulty is to find out which domain is suppose to be 2/3/4 level as these are all human defined.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2010 23:17:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54707#M13346</guid>
      <dc:creator>manwin</dc:creator>
      <dc:date>2010-09-21T23:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54708#M13347</link>
      <description>&lt;P&gt;Yeah, the heuristic approach of assuming that 3-level and greater contain a hostname might not work in some cases. If you're looking at just a fixed list, the more elegant solution may be to not extract the field at all, but to use a lookup table instead.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2010 00:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54708#M13347</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-22T00:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multi level domain</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54709#M13348</link>
      <description>&lt;P&gt;Just to update this very old thread, I did a work around to get this to work.&lt;BR /&gt;
I did additional extractions for 2,3,4 level domains and did taggings for the domains which are supposed to be grouped according to the individual levels.&lt;/P&gt;

&lt;P&gt;Thus my reports can be displayed with the specified domain levels.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 04:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Report-with-multi-level-domain/m-p/54709#M13348</guid>
      <dc:creator>manwin</dc:creator>
      <dc:date>2011-05-13T04:50:52Z</dc:date>
    </item>
  </channel>
</rss>

