<?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: searching bro_dns answers{} array in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345855#M175177</link>
    <description>&lt;P&gt;If answers &amp;amp; query are fields in your bro_dns data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;baseSearchWithYourIPAddressField  ipAddressField=* 
| join ipAddressFIeld 
 [
  search index=bro_dns_index
 | makemv answers 
 | mvexpand answers 
 | table answers query 
 | rename answers AS ipAddressField
 ] 
| table *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If answers &amp;amp; query are not fields in your bro_dns data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;baseSearchWithYourIPAddressField  ipAddressField=* 
| join ipAddressFIeld 
 [
  search index=bro_dns_index
 | rex "answers.+\[(?&amp;lt;answers&amp;gt;.*)\]" 
 | rex "query:\s+(?&amp;lt;query&amp;gt;.+)" 
 | makemv answers 
 | mvexpand answers 
 | table answers query 
 | rename answers AS ipAddressField
 ] 
| table *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Mar 2017 13:22:42 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2017-03-14T13:22:42Z</dc:date>
    <item>
      <title>searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345854#M175176</link>
      <description>&lt;P&gt;bro_dns shows the results of a dns query as what I presume is an array, for example:&lt;/P&gt;

&lt;P&gt;answers: [   [-] &lt;BR /&gt;
     mt-ingestion-service-mr22.itunes.apple.com &lt;BR /&gt;
     mt-ingestion-service-mr22.itunes-apple.com.akadns.net&lt;BR /&gt;&lt;BR /&gt;
     17.110.234.28&lt;BR /&gt;&lt;BR /&gt;
     17.110.232.46&lt;BR /&gt;&lt;BR /&gt;
     17.110.232.45&lt;BR /&gt;&lt;BR /&gt;
     17.110.234.27&lt;BR /&gt;&lt;BR /&gt;
   ]&lt;BR /&gt;&lt;BR /&gt;
  query: xp.itunes-apple.com.akadns.net &lt;/P&gt;

&lt;P&gt;I have IP addresses from other data sources that I want to search against "answers" so that I can get "query" from the above, but I cannot figure out how to search within this array (or set, or whatever it actually is).  Please help! &lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 13:36:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345854#M175176</guid>
      <dc:creator>splunkjosef</dc:creator>
      <dc:date>2017-03-11T13:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345855#M175177</link>
      <description>&lt;P&gt;If answers &amp;amp; query are fields in your bro_dns data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;baseSearchWithYourIPAddressField  ipAddressField=* 
| join ipAddressFIeld 
 [
  search index=bro_dns_index
 | makemv answers 
 | mvexpand answers 
 | table answers query 
 | rename answers AS ipAddressField
 ] 
| table *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If answers &amp;amp; query are not fields in your bro_dns data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;baseSearchWithYourIPAddressField  ipAddressField=* 
| join ipAddressFIeld 
 [
  search index=bro_dns_index
 | rex "answers.+\[(?&amp;lt;answers&amp;gt;.*)\]" 
 | rex "query:\s+(?&amp;lt;query&amp;gt;.+)" 
 | makemv answers 
 | mvexpand answers 
 | table answers query 
 | rename answers AS ipAddressField
 ] 
| table *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 13:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345855#M175177</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-14T13:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345856#M175178</link>
      <description>&lt;P&gt;Thank you, this is getting me started, but I am still not quite there.  I had to write "answers" as "answers{}" for this to work, and also I had to add the word "search" to the beginning of the statement in join, like this:&lt;/P&gt;

&lt;P&gt;[search sourcetype=bro_dns | makemv answers{} | mvexpand answers{} |  rename answers{} as ipAddressField]&lt;/P&gt;

&lt;P&gt;This returns the results I want, but only a subset.  The output of the base search (from bro_conn) includes some fields that are in common with the subsearch results from bro_dns, namely proto and port.  This join command only returns results where &lt;STRONG&gt;all&lt;/STRONG&gt; of these fields match, rather than just where answers matches my IPaddressfield.  In bro_dns, all of the results have proto=udp and port=53, so basically I am only getting "query" results returned when the base search (bro_conn) also has proto=udp and port=53.  The results of an http transaction on port 80, for example, does not return the query information despite this info being present in the bro_dns data.  I also tried adding type=outer to the join command, but this doesn't help... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Appreciate any further suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345856#M175178</guid>
      <dc:creator>splunkjosef</dc:creator>
      <dc:date>2020-09-29T13:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345857#M175179</link>
      <description>&lt;P&gt;It's the table command that was limiting your fields.  I have adjusted my answer.  Forgot to put the {} but you get the idea.  Give the revised answer a shot&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 15:34:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345857#M175179</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-19T15:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345858#M175180</link>
      <description>&lt;P&gt;I've actually already tried that and that doesn't seem to be the problem.  &lt;/P&gt;

&lt;P&gt;I think I may have figured out what the issue is, but don't know how to solve it.  The answers{} array typically contains multiple results (IPs and names).  The join command is only returning results if the IP address I am searching for is an exact match to answers{}.  In other words, only if answers{} contains a single entry which is the IP address in question.  If answers contains multiple IPs, one of which is the one I am looking for, it returns nothing.  So it seems I need a way to search for a partial match within the answers array.  &lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query   answers{}
p70-buy.itunes-apple.com.akadns.net 17.154.66.73

p70-buy.itunes.apple.com    p70-buy.itunes-apple.com.akadns.net 17.154.66.73
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can match "17.154.66.73" on the first row above, but not the second, because answers also contains "p70-buy.itunes-apple.com.akadns.net"&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2017 17:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345858#M175180</guid>
      <dc:creator>splunkjosef</dc:creator>
      <dc:date>2017-03-19T17:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345859#M175181</link>
      <description>&lt;P&gt;That's what the makemv and mvexpand are there for.  Can you give a sample of the data?  (sensitive details anonymized)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 02:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345859#M175181</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-20T02:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: searching bro_dns answers{} array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345860#M175182</link>
      <description>&lt;P&gt;This interface isn't very welcoming of copy/pastes, so I am hand-formatting in my example:&lt;/P&gt;

&lt;P&gt;This is an event in bro_dns that retuns a result from the join command when id.resp_h=17.249.105.246:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query: 
    something.apple.com
answers{}:
    17.249.105.246  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is an event in bro_dns that does not return a result on the join when id.resp_h=17.248.143.90&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query: 
    something.icloud.com
answers{}:
    something.apple-dns.net 
    17.248.143.90 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have checked a bunch of results, and as long as answers{} contains more than one entry, it will not match the join search.&lt;/P&gt;

&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=bro_conn | spath conn_state 
| search conn_state!=S0 OR conn_state!=REJ 
| lookup bro_conn_state.csv conn_state OUTPUT conn_state_meaning 
| join id.resp_h 
    [ search sourcetype=bro_dns earliest=-1@hr 
    | makemv answers{} 
    | mvexpand answers{} 
    | table query,answers{} | rename answers{} AS id.resp_h] 
| table _time,id.orig_h,dhcp_host_name,id.resp_h,id.resp_p,proto,query,answers{},conn_state_meaning 
| sort -_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I remove the join from this search and compare the results, that's when I see all of the missing events.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:21:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/searching-bro-dns-answers-array/m-p/345860#M175182</guid>
      <dc:creator>splunkjosef</dc:creator>
      <dc:date>2020-09-29T13:21:15Z</dc:date>
    </item>
  </channel>
</rss>

