<?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: Regex help for Bind DNS logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410651#M118516</link>
    <description>&lt;P&gt;Rich,&lt;/P&gt;

&lt;P&gt;Thx for the reply.&lt;/P&gt;

&lt;P&gt;Plugging in the regex you listed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (?J)client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\sdefault:\s(?&amp;lt;message_type&amp;gt;query)(: (?&amp;lt;query&amp;gt;\S+) (?&amp;lt;dns_request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*)\s\((?&amp;lt;host&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})\)| \(cache\) '(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;dns_request_class_name&amp;gt;[^']+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Returns the following error from the point of &lt;CODE&gt;'(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;dns_request_class_name&amp;gt;[^']+))&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;BR /&gt;
(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;BR /&gt;
(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2019 17:39:31 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2019-07-30T17:39:31Z</dc:date>
    <item>
      <title>Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410649#M118514</link>
      <description>&lt;P&gt;At some point in the past month, the existing extract in transforms.conf quit working and the DNS logs (ingesting from BlueCat syslog),  specifically queries, are no longer being parsed correctly. The extract in transforms.conf I have is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-process,pid,src,src_port,query = \d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2}\s\S+\s\S+\s(?P&amp;lt;process&amp;gt;\S+)\[(?&amp;lt;pid&amp;gt;\d+)\]\:\s+\S+\s+(?P&amp;lt;src&amp;gt;\S+)\#(?P&amp;lt;src_port&amp;gt;\S+)(\/\s|\s)\((?P&amp;lt;query&amp;gt;\S+)\)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Nothing has changed in the custom TA and as far as I can see the format of the DNS logs has not changed before/after parsing stopped working &lt;/P&gt;

&lt;P&gt;With that, I started to create a regex to replace the extract in transforms.conf. The regex is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\s(?&amp;lt;message_type&amp;gt;query):\s(?&amp;lt;query&amp;gt;\S+)\s(?&amp;lt;dns_request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*)\s\((?&amp;lt;host&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})\)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested it against generic query events with success:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-07-30 08:59:20 8.8.8.8 BLUECAT-LOG-MSG named[311]: client @0x7fc2c5f35e30 10.1.1.1#57195 (e1875.dscg.akamaiedge.net): view default: query: e1875.dscg.akamaiedge.net IN AAAA + (8.8.8.8)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While reviewing DNS query logs, I see a different query related event for cached queries:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-07-30 09:50:01 8.8.8.8 BLUECAT-LOG-MSG named[1054]: client @0x7f9f9bff1230 10.1.1.1#35281 (acp-ss-ue1.adobe.io): view default: query (cache) 'acp-ss-ue1.adobe.io/A/IN' denied
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I modify my regex to include cached query events, or am I better off creating a separate query for them?&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 15:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410649#M118514</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-07-30T15:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410650#M118515</link>
      <description>&lt;P&gt;Try this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\sdefault:\s(?&amp;lt;message_type&amp;gt;query)(: (?&amp;lt;query&amp;gt;\S+) (?&amp;lt;dns_request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*)\s\((?&amp;lt;host&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})\)| \(cache\) '(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;dns_request_class_name&amp;gt;[^']+))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jul 2019 17:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410650#M118515</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-30T17:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410651#M118516</link>
      <description>&lt;P&gt;Rich,&lt;/P&gt;

&lt;P&gt;Thx for the reply.&lt;/P&gt;

&lt;P&gt;Plugging in the regex you listed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (?J)client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\sdefault:\s(?&amp;lt;message_type&amp;gt;query)(: (?&amp;lt;query&amp;gt;\S+) (?&amp;lt;dns_request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*)\s\((?&amp;lt;host&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})\)| \(cache\) '(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;dns_request_class_name&amp;gt;[^']+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Returns the following error from the point of &lt;CODE&gt;'(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;dns_request_class_name&amp;gt;[^']+))&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;BR /&gt;
(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;BR /&gt;
(? A subpattern name must be unique&lt;BR /&gt;
) A subpattern name must be unique&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 17:39:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410651#M118516</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-07-30T17:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410652#M118517</link>
      <description>&lt;P&gt;Sorry about that.  I left out the &lt;CODE&gt;(?J)&lt;/CODE&gt; flag. Corrected.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 17:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410652#M118517</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-30T17:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410653#M118518</link>
      <description>&lt;P&gt;NP at all - added the (?J) as a global modifier at &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; and was able to match on both events - regular query and cache query.&lt;/P&gt;

&lt;P&gt;I modified the regex to remove 'host' as I am already pulling that via transforms.conf.&lt;/P&gt;

&lt;P&gt;Updated regex is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\sdefault:\s(?&amp;lt;message_type&amp;gt;query)(: (?&amp;lt;query&amp;gt;\S+) (?&amp;lt;request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*) | \(cache\) '(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;request_class_name&amp;gt;[^']+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Via props.conf and transforms.conf I am pulling the host as follows:&lt;BR /&gt;
[props.conf]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TRANSFORMS-host = bluecat_dns-host
FIELDALIAS-dns = host AS dns
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;[transforms.conf]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[bluecat_dns-host]
DEST_KEY = MetaData:Host
REGEX = \d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2}\s(\S+)\s 
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With all of that, can I replace the extract in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-process,pid,src,src_port,query = \d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2}\s\S+\s\S+\s(?P&amp;lt;process&amp;gt;\S+)\[(?&amp;lt;pid&amp;gt;\d+)\]\:\s+\S+\s+(?P&amp;lt;src&amp;gt;\S+)\#(?P&amp;lt;src_port&amp;gt;\S+)(\/\s|\s)\((?P&amp;lt;query&amp;gt;\S+)\)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the new extract:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-src,src_port,message_type,query,request_class_name,record_type,flag,host = (?J) client\s@.+\s(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|(?:::)?(?:[a-zA-Z\d]{1,4}::?){1,7}[a-zA-Z\d]{0,4})#(?&amp;lt;src_port&amp;gt;\d+).*\sdefault:\s(?&amp;lt;message_type&amp;gt;query)(: (?&amp;lt;query&amp;gt;\S+) (?&amp;lt;request_class_name&amp;gt;\w+)\s(?&amp;lt;record_type&amp;gt;\w+)\s(?&amp;lt;flag&amp;gt;(?:\+|\-)\S*) | \(cache\) '(?&amp;lt;query&amp;gt;[^\/]+)\/(?&amp;lt;record_type&amp;gt;[^\/]+)\/(?&amp;lt;request_class_name&amp;gt;[^']+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 19:24:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410653#M118518</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-07-30T19:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410654#M118519</link>
      <description>&lt;P&gt;That should work.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:09:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410654#M118519</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-31T12:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help for Bind DNS logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410655#M118520</link>
      <description>&lt;P&gt;TYVM Rich!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-for-Bind-DNS-logs/m-p/410655#M118520</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-07-31T12:35:54Z</dc:date>
    </item>
  </channel>
</rss>

