<?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 to exclude results from joined subsearches if the field value appears in a 3rd sourcetype? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643006#M222721</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I ran into a tricky one and can’t wrap my head around it (or if it is even possible).&amp;nbsp; The use case is as follows:&lt;/P&gt;
&lt;P&gt;There are 3 sourcetypes that share a common field “Detection_id”.&amp;nbsp; This field has a unique value that appears in all 3 sourcetypes.&lt;/P&gt;
&lt;P&gt;The first sourcetype is “DetectionName” and the 2nd sourcetype is “ProcessInfo”.&amp;nbsp; I did a &lt;STRONG&gt;&lt;U&gt;join&lt;/U&gt;&lt;/STRONG&gt; based on the “Detection_id” field so that way I can see my detection names displayed in a table right next to the process information responsible for the detection from the 2nd sourcetype. &amp;nbsp;That search works fine.&lt;/P&gt;
&lt;P&gt;This is where it gets a bit tricky.&amp;nbsp; The 3rd sourcetype is called “FalsePositive” meaning it was a detection that was already investigated and considered false positive.&amp;nbsp; We do not want any events displaying in our table from the first two searches&lt;STRONG&gt; IF&lt;/STRONG&gt; the same unique “Detection_id” value also appears in the “FalsePositive” sourcetype.&amp;nbsp; That way time isn’t wasted scrolling through detections that were already investigated.&lt;/P&gt;
&lt;P&gt;Any thoughts on the best way to handle this and/or if it is even possible?&lt;/P&gt;
&lt;P&gt;Appreciate any answers or feedback.&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2023 11:09:16 GMT</pubDate>
    <dc:creator>Splunk2095</dc:creator>
    <dc:date>2023-05-11T11:09:16Z</dc:date>
    <item>
      <title>How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643006#M222721</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I ran into a tricky one and can’t wrap my head around it (or if it is even possible).&amp;nbsp; The use case is as follows:&lt;/P&gt;
&lt;P&gt;There are 3 sourcetypes that share a common field “Detection_id”.&amp;nbsp; This field has a unique value that appears in all 3 sourcetypes.&lt;/P&gt;
&lt;P&gt;The first sourcetype is “DetectionName” and the 2nd sourcetype is “ProcessInfo”.&amp;nbsp; I did a &lt;STRONG&gt;&lt;U&gt;join&lt;/U&gt;&lt;/STRONG&gt; based on the “Detection_id” field so that way I can see my detection names displayed in a table right next to the process information responsible for the detection from the 2nd sourcetype. &amp;nbsp;That search works fine.&lt;/P&gt;
&lt;P&gt;This is where it gets a bit tricky.&amp;nbsp; The 3rd sourcetype is called “FalsePositive” meaning it was a detection that was already investigated and considered false positive.&amp;nbsp; We do not want any events displaying in our table from the first two searches&lt;STRONG&gt; IF&lt;/STRONG&gt; the same unique “Detection_id” value also appears in the “FalsePositive” sourcetype.&amp;nbsp; That way time isn’t wasted scrolling through detections that were already investigated.&lt;/P&gt;
&lt;P&gt;Any thoughts on the best way to handle this and/or if it is even possible?&lt;/P&gt;
&lt;P&gt;Appreciate any answers or feedback.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 11:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643006#M222721</guid>
      <dc:creator>Splunk2095</dc:creator>
      <dc:date>2023-05-11T11:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643011#M222723</link>
      <description>&lt;P&gt;Firstly, try to avoid using join if possible as it is slow and has limitations&lt;/P&gt;&lt;P&gt;Secondly, you could combine your searches into one and then determine which detection_ids are not represented in the false positive sourcetype&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="DetectionName" OR sourcetype="ProcessInfo" OR sourcetype="FalsePositive"
| eventstats values(sourcetype) as sourcetype by Detection_id
| where sourcetype!="FalsePositive"
| stats values(*) as * by Detection_id&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 May 2023 10:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643011#M222723</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-05-11T10:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643022#M222730</link>
      <description>&lt;P&gt;Thanks for the quick response!&amp;nbsp; and yes I hate join... making Splunk do 2 searches every time it runs breaks my heart.&lt;/P&gt;&lt;P&gt;Will your example also work if for instance, I want my search to be based on sourcetype="DetectionName" AND detect_name="Bypass UAC" ?&amp;nbsp; So putting that first one in brackets?&lt;/P&gt;&lt;P&gt;Essentially I will be having a scheduled search for each detection name so events can be grouped and analyzed based on the attack tactic.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 11:30:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643022#M222730</guid>
      <dc:creator>Splunk2095</dc:creator>
      <dc:date>2023-05-11T11:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643023#M222731</link>
      <description>&lt;P&gt;Yes, this should work&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(sourcetype="DetectionName" AND detect_name="Bypass UAC") OR sourcetype="ProcessInfo" OR sourcetype="FalsePositive"&lt;/LI-CODE&gt;&lt;P&gt;You also might want to change the where so that it is look for both valid sourcetypes as well as not having the FalsePositive sourcetype - by not having this extra check you are effectively doing a union i.e. events could come from either or both of the desired sourcetypes.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 11:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643023#M222731</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-05-11T11:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643038#M222742</link>
      <description>&lt;P&gt;Hmm so the search does run, but it is never producing results.&amp;nbsp; I tested multiple variations, but this is the jist:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=main (sourcetype="DetectionName" AND detect_name="Bypass UAC") OR sourcetype="ProcessInfo" OR sourcetype="FalsePositive"&lt;BR /&gt;| eventstats values(sourcetype) as sourcetype by Detection_id&lt;BR /&gt;| where sourcetype!="FalsePositive" AND sourcetype="DetectionName" AND sourcetype="ProcessInfo"&lt;BR /&gt;| stats values(ComputerName) as ComputerName values(detect_description) as detect_description values(detect_name) as detect_name values(detect_scenario) as detect_scenario values(Process) as Process values(CommandLine) as CommandLine by Detection_id&lt;/P&gt;&lt;P&gt;When I take away the &lt;STRONG&gt;where&lt;/STRONG&gt; clause it runs but of course produces a long list of stuff where the majority are missing key field values (detect_description, detect_name, detect_scenario are all unique fields in the DetectionName sourcetype while Process and CommandLine are unique fields in the ProcessInfo sourcetype).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 12:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643038#M222742</guid>
      <dc:creator>Splunk2095</dc:creator>
      <dc:date>2023-05-11T12:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643053#M222748</link>
      <description>&lt;P&gt;Here is a runanywhere example of this technique working&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=20
| fields - _time
| eval sourcetype=mvindex(split("DetectionName,ProcessInfo,FalsePositive",","),random()%3)
| eval Detection_id=random()%10
| eval detect_name=if(sourcetype="DetectionName","Bypass UAC",null())
| eval Process=if(sourcetype="ProcessInfo",mvindex(split("xyz",""),random()%3).mvindex(split("xyz",""),random()%3).mvindex(split("xyz",""),random()%3),null())
| eventstats values(sourcetype) as sourcetype by Detection_id
| where sourcetype!="FalsePositive" AND sourcetype="DetectionName" AND sourcetype="ProcessInfo"
| stats values(detect_name) as detect_name values(Process) as Process values(sourcetype) as sourcetype by Detection_id&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 May 2023 13:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643053#M222748</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-05-11T13:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude results from joined subsearches if the field value appears in a 3rd sourcetype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643064#M222753</link>
      <description>&lt;P&gt;I got it working!!!!&lt;/P&gt;&lt;P&gt;After specifying the original sourcetypes in the beginning, I did a pipe to&amp;nbsp;&lt;STRONG&gt;fields&lt;/STRONG&gt; and specified all fields that were going to be included in some form or another from each of the sourcetypes.&lt;/P&gt;&lt;P&gt;Then I tested by having a wildcard for the detection name and having |where sourcetype="FalsePositive".&amp;nbsp; I saw 4 results and wrote down the detect_id's.&amp;nbsp; Then I ran the same search but did |where sourcetype!="FalsePositive" and it displayed even more events, but none with the detect_id that showed up when including "FalsePositive".&lt;/P&gt;&lt;P&gt;Brain is fried hope that makes sense lol.&amp;nbsp; Either way, thank you so much!&amp;nbsp; I wouldn't have reached this point without your help.&amp;nbsp; Also, the search runs so much faster than using&amp;nbsp;&lt;STRONG&gt;join&amp;nbsp;&lt;/STRONG&gt;ofc :).&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 14:58:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-results-from-joined-subsearches-if-the-field/m-p/643064#M222753</guid>
      <dc:creator>Splunk2095</dc:creator>
      <dc:date>2023-05-11T14:58:36Z</dc:date>
    </item>
  </channel>
</rss>

