<?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: How do I write the regex to extract a DNS domain field from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221480#M65096</link>
    <description>&lt;P&gt;How about keying the regex off the closing bracket? Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(Base search)| rex "\]\s+\w+\s+(?&amp;lt;dns_domain&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Nov 2015 00:25:30 GMT</pubDate>
    <dc:creator>adauria_splunk</dc:creator>
    <dc:date>2015-11-09T00:25:30Z</dc:date>
    <item>
      <title>How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221479#M65095</link>
      <description>&lt;P&gt;Hi :&lt;/P&gt;

&lt;P&gt;I need help extracting the domain IP address for the DNS logs. The automatic field extractor does not work in my case.&lt;/P&gt;

&lt;P&gt;Here is the sample raw file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11/8/2015 5:17:24 PM 1A5C PACKET  000000B9E66AE560 UDP Rcv 10.230.138.230  9bf2   Q [1001   D   NOERROR] AAAA   access-qa.truvenhealth.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need splunk to extract &lt;CODE&gt;access-qa.truvenhealth.com&lt;/CODE&gt; as a field. I am unable to do so because the regex pattern doesn't fit it well.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2015 23:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221479#M65095</guid>
      <dc:creator>OMohi</dc:creator>
      <dc:date>2015-11-08T23:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221480#M65096</link>
      <description>&lt;P&gt;How about keying the regex off the closing bracket? Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(Base search)| rex "\]\s+\w+\s+(?&amp;lt;dns_domain&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2015 00:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221480#M65096</guid>
      <dc:creator>adauria_splunk</dc:creator>
      <dc:date>2015-11-09T00:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221481#M65097</link>
      <description>&lt;P&gt;If it is always the last thing, then like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?&amp;lt;dns_domain&amp;gt;[\S]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2015 06:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221481#M65097</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-09T06:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221482#M65098</link>
      <description>&lt;P&gt;This is interesting; I understand that both answers work and are correct but it is not supposed to be possible to &lt;CODE&gt;Accept&lt;/CODE&gt; more than 1 answer.  @OMohi, how were you able to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 15:50:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221482#M65098</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-09T15:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221483#M65099</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?\w+)\.(?.*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 18:44:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221483#M65099</guid>
      <dc:creator>dkadavis</dc:creator>
      <dc:date>2019-06-25T18:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221484#M65100</link>
      <description>&lt;P&gt;Since the original post did not keep all the information I've updated this to reflect the correct statements and added one just in case you have additional characters in the name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field="dnsName" "(?&amp;lt;name_Host_Dns&amp;gt;\w+)\.(?&amp;lt;name_Domain_Dns&amp;gt;.*)"

| rex field="dnsName" "(?&amp;lt;name_Host_Dns&amp;gt;[a-zA-Z0-9-_]+)\.(?&amp;lt;name_Domain_Dns&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Optionally you can do this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field="dnsname" "(?&amp;lt;dnsdomain&amp;gt;\..*)"
| eval dnshostname = replace('dnsname',dnsdomain',"")
| eval dnsdomain = replace(dnsdomain,"^.{1}","") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 18:48:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221484#M65100</guid>
      <dc:creator>dkadavis</dc:creator>
      <dc:date>2019-06-25T18:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221485#M65101</link>
      <description>&lt;P&gt;Use markdown:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/static/markdown/help.html"&gt;https://answers.splunk.com/static/markdown/help.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 18:51:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221485#M65101</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-25T18:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221486#M65102</link>
      <description>&lt;P&gt;I added code-markdown.  Go in and keep the leading spaces and fix it the way that it should look and it will stick.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 19:12:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221486#M65102</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-25T19:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221487#M65103</link>
      <description>&lt;P&gt;Why complicate it?  Just anchor it to the end like @woodcock suggested.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 19:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221487#M65103</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-25T19:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract a DNS domain field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221488#M65104</link>
      <description>&lt;P&gt;Thanks for the assist.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 19:50:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-a-DNS-domain-field-from-my/m-p/221488#M65104</guid>
      <dc:creator>dkadavis</dc:creator>
      <dc:date>2019-06-25T19:50:49Z</dc:date>
    </item>
  </channel>
</rss>

