<?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 How do you exclude and format unique specific fields from multivalued fields to be used in a subsearch? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451269#M127789</link>
    <description>&lt;P&gt;Hello all, &lt;/P&gt;

&lt;P&gt;I'm having some trouble formatting and dealing with multivalued fields.&lt;/P&gt;

&lt;P&gt;My use case is as follows: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I have sourcetype-A that returns known malicious indicators (through multi-valued fields)&lt;/LI&gt;
&lt;LI&gt;I have sourcetype-B that has DNS query logs from hosts&lt;/LI&gt;
&lt;LI&gt;I'd like to make a search where I compile a list of "known malicious" domains from sourcetype-A, and in a subsearch (with soucetype-B being the main base search), compare all queries against the list created from the subsearch to see if a host queried a "malicious domain" (different index from sourcetype-A)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;A sample log for sourcetype A looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                     Field                    Values
Event 1              indicator                x.xxx.x.xx
                                              hash
                                              someDomain.com
                                              &lt;A href="http://DomainA.com" target="test_blank"&gt;http://DomainA.com&lt;/A&gt;
                                              supermalicious.com

Event 2              indicator                someDomain.com
                                              &lt;A href="https://community.splunk.com/www.domainA.com" target="test_blank"&gt;www.domainA.com&lt;/A&gt;
                                              someEmailAddress@domain.com
                                              &lt;A href="http://helpmepls.com" target="test_blank"&gt;http://helpmepls.com&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I use &lt;CODE&gt;| eval indicator=mvfilter(match(indicator, "\."))&lt;/CODE&gt; and  &lt;CODE&gt;|stats values(indicator)&lt;/CODE&gt;, I receive somewhat of expected results (hashes are now gone and values are deduped across all events), but I still have the issue of having to exclude everything else that's not a domain or a URL.&lt;/P&gt;

&lt;P&gt;I was thinking of using something like a URL parser app for Splunk to help with the formatting issues, but for that, I don't think I'm able to get by using &lt;CODE&gt;|stats values(indicators)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Expected results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;someDomain.com
domainA.com
supermalicious.com
helpmepls.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd appreciate if someone could point me in the correct direction or tell me if this is even possible through Splunk.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Feb 2019 20:29:49 GMT</pubDate>
    <dc:creator>nickcardenas</dc:creator>
    <dc:date>2019-02-11T20:29:49Z</dc:date>
    <item>
      <title>How do you exclude and format unique specific fields from multivalued fields to be used in a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451269#M127789</link>
      <description>&lt;P&gt;Hello all, &lt;/P&gt;

&lt;P&gt;I'm having some trouble formatting and dealing with multivalued fields.&lt;/P&gt;

&lt;P&gt;My use case is as follows: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I have sourcetype-A that returns known malicious indicators (through multi-valued fields)&lt;/LI&gt;
&lt;LI&gt;I have sourcetype-B that has DNS query logs from hosts&lt;/LI&gt;
&lt;LI&gt;I'd like to make a search where I compile a list of "known malicious" domains from sourcetype-A, and in a subsearch (with soucetype-B being the main base search), compare all queries against the list created from the subsearch to see if a host queried a "malicious domain" (different index from sourcetype-A)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;A sample log for sourcetype A looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                     Field                    Values
Event 1              indicator                x.xxx.x.xx
                                              hash
                                              someDomain.com
                                              &lt;A href="http://DomainA.com" target="test_blank"&gt;http://DomainA.com&lt;/A&gt;
                                              supermalicious.com

Event 2              indicator                someDomain.com
                                              &lt;A href="https://community.splunk.com/www.domainA.com" target="test_blank"&gt;www.domainA.com&lt;/A&gt;
                                              someEmailAddress@domain.com
                                              &lt;A href="http://helpmepls.com" target="test_blank"&gt;http://helpmepls.com&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I use &lt;CODE&gt;| eval indicator=mvfilter(match(indicator, "\."))&lt;/CODE&gt; and  &lt;CODE&gt;|stats values(indicator)&lt;/CODE&gt;, I receive somewhat of expected results (hashes are now gone and values are deduped across all events), but I still have the issue of having to exclude everything else that's not a domain or a URL.&lt;/P&gt;

&lt;P&gt;I was thinking of using something like a URL parser app for Splunk to help with the formatting issues, but for that, I don't think I'm able to get by using &lt;CODE&gt;|stats values(indicators)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Expected results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;someDomain.com
domainA.com
supermalicious.com
helpmepls.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd appreciate if someone could point me in the correct direction or tell me if this is even possible through Splunk.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 20:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451269#M127789</guid>
      <dc:creator>nickcardenas</dc:creator>
      <dc:date>2019-02-11T20:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you exclude and format unique specific fields from multivalued fields to be used in a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451270#M127790</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="10.123.4.56,hash,someDomain.com,http://DomainA.com,supermalicious.com someDomain.com,www.domainA.com,someEmailAddress@domain.com,http://helpmepls.com" 
| makemv raw 
| mvexpand raw 
| rename raw AS _raw 
| rex max_match=0 "(?&amp;lt;indicator&amp;gt;[^,]+)" 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rex field=indicator mode=sed "s%^[^:/]+://%% s/^www\.//"
| eval indicator=mvfilter(match(indicator, "\.") AND NOT match(indicator, "(^\d+\.\d+\.\d+\.\d+$)|@"))
| eval indicator=lower(indicator)
| stats values(indicator)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Feb 2019 02:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451270#M127790</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-12T02:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you exclude and format unique specific fields from multivalued fields to be used in a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451271#M127791</link>
      <description>&lt;P&gt;Brilliant! This works as expected! I'll need to tinker with the regex to also omit IP addresses with specified ports such as&lt;CODE&gt;123.123.123.2:8080&lt;/CODE&gt; but once I add this, the provided answer will do exactly what I'm looking for. &lt;/P&gt;

&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 15:16:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-exclude-and-format-unique-specific-fields-from/m-p/451271#M127791</guid>
      <dc:creator>nickcardenas</dc:creator>
      <dc:date>2019-02-13T15:16:46Z</dc:date>
    </item>
  </channel>
</rss>

