<?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 Extract domains from raw data into a new field and create a table with count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-domains-from-raw-data-into-a-new-field-and-create-a/m-p/575798#M200648</link>
    <description>&lt;P&gt;I have raw data, I would like to search for domains within the data, output it to a field and then run stats to show a count of each unique domain.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Example of raw data:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;"This investigation is really great and we found the suspicious domain google.com"&lt;BR /&gt;&lt;BR /&gt;I would like to:&lt;BR /&gt;1. search for domains within raw data and output the domain to a field that I can show in a table (Lets call it "Domain")&lt;BR /&gt;2. run stats that show the number of occurrences&lt;BR /&gt;&lt;BR /&gt;So ideally, my finished result would be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Domain&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;google.com&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;yahoo.com&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance is greatly appreciated, thank you.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Nov 2021 21:09:30 GMT</pubDate>
    <dc:creator>lilvermi</dc:creator>
    <dc:date>2021-11-21T21:09:30Z</dc:date>
    <item>
      <title>Extract domains from raw data into a new field and create a table with count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-domains-from-raw-data-into-a-new-field-and-create-a/m-p/575798#M200648</link>
      <description>&lt;P&gt;I have raw data, I would like to search for domains within the data, output it to a field and then run stats to show a count of each unique domain.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Example of raw data:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;"This investigation is really great and we found the suspicious domain google.com"&lt;BR /&gt;&lt;BR /&gt;I would like to:&lt;BR /&gt;1. search for domains within raw data and output the domain to a field that I can show in a table (Lets call it "Domain")&lt;BR /&gt;2. run stats that show the number of occurrences&lt;BR /&gt;&lt;BR /&gt;So ideally, my finished result would be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Domain&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;google.com&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;yahoo.com&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance is greatly appreciated, thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 21:09:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-domains-from-raw-data-into-a-new-field-and-create-a/m-p/575798#M200648</guid>
      <dc:creator>lilvermi</dc:creator>
      <dc:date>2021-11-21T21:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extract domains from raw data into a new field and create a table with count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-domains-from-raw-data-into-a-new-field-and-create-a/m-p/575800#M200650</link>
      <description>&lt;P&gt;Key is how to recognise a domain. You can google for regex to extract domains and get some examples, but this search will show you how to get started&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval d=split("google.com,abc.net.au,bbc.co.uk,google.com,splunk.com,www.nytimes.com", ",")
| mvexpand d
| rex field=d "(?&amp;lt;domain&amp;gt;(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9])"
| stats count by domain&lt;/LI-CODE&gt;&lt;P&gt;In your example, use rex field=_raw rather than 'd' in the above.&lt;/P&gt;&lt;P&gt;If you might have more than one domain in your raw data then add the 'max_match=0' to the rex statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 21:21:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-domains-from-raw-data-into-a-new-field-and-create-a/m-p/575800#M200650</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-11-21T21:21:32Z</dc:date>
    </item>
  </channel>
</rss>

