<?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: Extracting domain name out of a url in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71917#M17977</link>
    <description>&lt;P&gt;I don think this works any more ... &lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2016 01:31:43 GMT</pubDate>
    <dc:creator>mIliofotou_splu</dc:creator>
    <dc:date>2016-08-29T01:31:43Z</dc:date>
    <item>
      <title>Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71911#M17971</link>
      <description>&lt;P&gt;I am trying to field extraction working for just domains accessed on my Ironport WSAs but am having an issue extracting just the domain piece out of a url.&lt;BR /&gt;
For example, if I do a search by top s_hostname I get the following:
0.4.channel.facebook.com
0.52.channel.facebook.com
0.57.channel.facebook.com
0.chstatic.cvcdn.com
0.gvt0.com
0.media.dorkly.cvcdn.com
0.media.todaysbigthing.cvcdn.com
0.r.msn.com
0.tqn.com
0.track.ning.com
I am trying to get a regex working to strip everything out to the left of the domain name so I would only see facebook.com and not 0.4.channel.facebook.com.  I am not having any luck coming up with a regex to handle this.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2010 04:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71911#M17971</guid>
      <dc:creator>imarks004</dc:creator>
      <dc:date>2010-10-17T04:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71912#M17972</link>
      <description>&lt;P&gt;Assuming you always want only two levels:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=s_hostname "\.(?&amp;lt;s_domainname&amp;gt;\S+\.\S+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Oct 2010 04:23:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71912#M17972</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-10-17T04:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71913#M17973</link>
      <description>&lt;P&gt;Probably a more efficient regex is: &lt;CODE&gt;(?&amp;lt;s_domainname&amp;gt;[^\.\s]+\.[^\.\s]+)$&lt;/CODE&gt; instead.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2010 22:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71913#M17973</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-10-17T22:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71914#M17974</link>
      <description>&lt;P&gt;This can also be even more efficient (if either com.br, com.pe, com.jo):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;_hostname&amp;gt;(\d{1,3}.\d{1,3}?|[^\.\s]+?)\.([^\.\s]{1,3}|[^\.\s]{1,3}\.[^\.\s]{1,3}))$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Mar 2014 20:03:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71914#M17974</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-03-05T20:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71915#M17975</link>
      <description>&lt;P&gt;Extraction can easily be done by some simple steps given at &lt;A href="http://www.perlmonks.org/?node_id=670802"&gt;http://www.perlmonks.org/?node_id=670802&lt;/A&gt;. Various formulas are also available that can easily extract &lt;A href="https://domainia.com/popular-domain-names"&gt;domain name&lt;/A&gt; from the URL using Regex who’s examples you can see at above site too. After reading if still some query remains unsolved feel free to ask..&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2015 13:58:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71915#M17975</guid>
      <dc:creator>stanleyglover</dc:creator>
      <dc:date>2015-02-13T13:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71916#M17976</link>
      <description>&lt;P&gt;To deal with all the various examples in this thread and all other possible cases such as new domains like .london, I think it will need something more than a reasonably short regex line.&lt;/P&gt;

&lt;P&gt;I would probably go down the route of calling a Python script to deal with the cases to my satisfaction and being able to lay out the logic in a maintainable way. Maybe there is a splunk app or add-on that provides such functionality, if not, it could make a nice exercise to create one.&lt;/P&gt;

&lt;P&gt;A few test cases:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;conductor.io.com =&amp;gt; io.com
support.expedia.co.uk =&amp;gt; expedia.co.uk
0.52.channel.facebook.com =&amp;gt; facebook.com
0.52.channel.facebook.london =&amp;gt; facebook.london
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Feb 2015 18:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71916#M17976</guid>
      <dc:creator>tpflicke</dc:creator>
      <dc:date>2015-02-13T18:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71917#M17977</link>
      <description>&lt;P&gt;I don think this works any more ... &lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 01:31:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71917#M17977</guid>
      <dc:creator>mIliofotou_splu</dc:creator>
      <dc:date>2016-08-29T01:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71918#M17978</link>
      <description>&lt;P&gt;I ended up going with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/\/(?:[^@\/\n]+@)?(?:www\.)?(?&amp;lt;refdomain&amp;gt;[^:\/\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Used it context it looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;method=GET| rex field=referer "\/\/(?:[^@\/\n]+@)?(?:www\.)?(?&amp;lt;refdomain&amp;gt;[^:\/\n]+)"| stats values(refdomain)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the extraction in action &lt;A href="https://regex101.com/r/iVrIlL/1"&gt;https://regex101.com/r/iVrIlL/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 16:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71918#M17978</guid>
      <dc:creator>GeekMikeGrace</dc:creator>
      <dc:date>2017-05-12T16:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71919#M17979</link>
      <description>&lt;P&gt;There's an App for that! The &lt;A href="https://splunkbase.splunk.com/app/2734/"&gt;URL toolbox&lt;/A&gt; is my absolute fav but maybe &lt;A href="https://splunkbase.splunk.com/app/3396/"&gt;URL Parse&lt;/A&gt; already does the trick?&lt;/P&gt;

&lt;P&gt;Your SPL would look like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`method=GET| ut_parse(referer)`  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Make sure you use the back tick so Splunk knows you are calling a macro.&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 19:48:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71919#M17979</guid>
      <dc:creator>fwijnholds_splu</dc:creator>
      <dc:date>2017-05-12T19:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71920#M17980</link>
      <description>&lt;P&gt;I downvoted this post because does not work anymore. n&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 10:58:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71920#M17980</guid>
      <dc:creator>dariusdamalakas</dc:creator>
      <dc:date>2017-05-25T10:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71921#M17981</link>
      <description>&lt;P&gt;Takes everything up until 3rd slash&lt;/P&gt;

&lt;P&gt;rex field=Uri "^(?[^/]&lt;EM&gt;/[^/]&lt;/EM&gt;/[^/]*)" &lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 10:58:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71921#M17981</guid>
      <dc:creator>dariusdamalakas</dc:creator>
      <dc:date>2017-05-25T10:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting domain name out of a url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71922#M17982</link>
      <description>&lt;P&gt;This worked for me. &lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 15:52:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-domain-name-out-of-a-url/m-p/71922#M17982</guid>
      <dc:creator>mstephenson716</dc:creator>
      <dc:date>2019-07-01T15:52:40Z</dc:date>
    </item>
  </channel>
</rss>

