<?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 to join two searches using one field AND a time constraint between the correlated events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630431#M219028</link>
    <description>&lt;P&gt;You mentioned 13 events in pan_logs. &amp;nbsp;What is event count in sysmon?&lt;/P&gt;&lt;PRE&gt;index=sysmon EventID=22&lt;/PRE&gt;&lt;P&gt;Does this make up the difference of 1728 - 13? &amp;nbsp;If the two searches joined with OR add up to 1728, event count is correct.&lt;/P&gt;&lt;P&gt;The important task is correlation. &amp;nbsp;You need to illustrate your data (anonymize as needed), explain key data characteristics, illustrate the results, then explain why the results are "wrong".&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2023 12:03:28 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-02-10T12:03:28Z</dc:date>
    <item>
      <title>How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630337#M218988</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to get a list of workstations trying to connect to malicious DNS using PaloAlto and SYSMON logs.&lt;/P&gt;&lt;P&gt;From PaloAlto logs I get the list of malicious domains detected and blocked with the following query and I do a join statement looking for each malicious domain a DNS request entry in the sysmon log.&lt;/P&gt;&lt;P&gt;The query&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="pan_logs" dns sourcetype="pan:threat" dest_zone=External dest_port=53 vendor_action=sinkhole  (action=dropped OR action=blocked) 
| dedup _time,file_name 
| table _time file_name 
| rename file_name as QueryName 
| join QueryName 
    [ search index=sysmon EventID=22 
    | eval host_querying=Computer
    | table QueryName, host_querying] 
| table _time QueryName host_querying&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my issue comes when there are several computers accessing to the same malicious domain. The first occurrence found in the sysmon index is assigned to all the requests.&lt;/P&gt;&lt;P&gt;I would like to join based on the domain and a time limit between correlated events.&lt;/P&gt;&lt;P&gt;is it possible to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 17:17:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630337#M218988</guid>
      <dc:creator>corti77</dc:creator>
      <dc:date>2023-02-09T17:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630422#M219020</link>
      <description>&lt;P&gt;The command you are looking for is &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Bin" target="_blank" rel="noopener"&gt;bin&lt;/A&gt;. &amp;nbsp;But for simple correlation like this, I'd also avoid using join. &amp;nbsp;Retrieve events from both sources and use stats.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="pan_logs" dns sourcetype="pan:threat" dest_zone=External dest_port=53 vendor_action=sinkhole  (action=dropped OR action=blocked))
OR (index=sysmon EventID=22)
| bin span=5m _time
| eval QueryName = coalesce(file_name, QueryName)
| stats values(Computer) as host_querying by _time QueryName&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 11:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630422#M219020</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-10T11:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630427#M219024</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your answer but it returns wrong results.&lt;/P&gt;&lt;P&gt;When I run the first part of the query independently for the last 60 minutes, I receive 13 events&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="pan_logs" sourcetype="pan:threat" vendor_action=sinkhole &lt;/LI-CODE&gt;&lt;P&gt;But when I execute the whole query mixing both indexes I get 1728 events&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="pan_logs" sourcetype="pan:threat" vendor_action=sinkhole )
OR (index=sysmon EventID=22)
| bin span=5m _time
| eval QueryName = coalesce(file_name, QueryName)
| stats values(Computer) as host_querying by _time QueryName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I follow the approach using bin but for some reason is wrongly catching much more events.&lt;/P&gt;&lt;P&gt;any idea of what could be the reason?&lt;/P&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 11:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630427#M219024</guid>
      <dc:creator>corti77</dc:creator>
      <dc:date>2023-02-10T11:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630431#M219028</link>
      <description>&lt;P&gt;You mentioned 13 events in pan_logs. &amp;nbsp;What is event count in sysmon?&lt;/P&gt;&lt;PRE&gt;index=sysmon EventID=22&lt;/PRE&gt;&lt;P&gt;Does this make up the difference of 1728 - 13? &amp;nbsp;If the two searches joined with OR add up to 1728, event count is correct.&lt;/P&gt;&lt;P&gt;The important task is correlation. &amp;nbsp;You need to illustrate your data (anonymize as needed), explain key data characteristics, illustrate the results, then explain why the results are "wrong".&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 12:03:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630431#M219028</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-10T12:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630434#M219030</link>
      <description>&lt;P&gt;Hi @Anonymous&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I try to explain again what I expect to obtain.&lt;/P&gt;&lt;P&gt;With this first query I extract the malicious DNS requests that our Palo Alto firewall has blocked.&lt;BR /&gt;&lt;SPAN&gt;The result for the last 60 minutes is 6 occurrences.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="pan_logs" sourcetype="pan:threat" vendor_action=sinkhole
| table _time, file_name&lt;/LI-CODE&gt;&lt;P&gt;_time&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_name&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;2023-02-10 12:32:55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;2023-02-10 12:32:55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;2023-02-10 12:34:01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&lt;/P&gt;&lt;P&gt;Now I want to identify exactly which workstation asked for those malicious DNS resolutions.&lt;BR /&gt;For that, I leverage SYSMON logs which are easier to understand than the Windows DNS logs located in the DC servers.&lt;/P&gt;&lt;P&gt;The SYSMON query for the last 60 minutes returns 1466 events. Those events include legit and malicious ones.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sysmon EventID=22 
| table QueryName, host&lt;/LI-CODE&gt;&lt;P&gt;Now I would like to correlate both datasets with the final goal of obtaining 6 events with the URL(file_name filed) and the requester (host)&lt;/P&gt;&lt;P&gt;_time&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XXXXX&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XXXXX&lt;/P&gt;&lt;P&gt;2023-02-10 12:33:00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YYYYY&lt;/P&gt;&lt;P&gt;2023-02-10 12:32:55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YYYYY&lt;/P&gt;&lt;P&gt;2023-02-10 12:32:55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ZZZZZ&lt;/P&gt;&lt;P&gt;2023-02-10 12:34:01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jingermy.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ZZZZZ&lt;/P&gt;&lt;P&gt;Using your query I get more than a thousand events, containing many legit domains.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Instead, using my query&amp;nbsp;I get the same number of events before and after the join, BUT the host extracted from sysmon index corresponds with the first occurrence in the index and is not related to the original _time from Palo Alto logs.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="pan_logs" sourcetype="pan:threat" vendor_action=sinkhole
| rename file_name as QueryName
| table _time,QueryName
| join   QueryName 
    [ search index=sysmon EventID=22 
        | table QueryName, host] 
| table _time QueryName host&lt;/LI-CODE&gt;&lt;P&gt;I hope it is clear now. many thanks once again.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 12:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630434#M219030</guid>
      <dc:creator>corti77</dc:creator>
      <dc:date>2023-02-10T12:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to join two searches using one field AND a time constraint between the correlated events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630490#M219051</link>
      <description>&lt;P&gt;So, the missed requirement is that QueryName must appear in both indices. &amp;nbsp;That's easy. &amp;nbsp;Just count the indices.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="pan_logs" sourcetype="pan:threat" vendor_action=sinkhole )
OR (index=sysmon EventID=22)
| bin span=5m _time
| eval QueryName = coalesce(file_name, QueryName)
| stats values(Computer) as host_querying dc(index) as sources by _time QueryName
| where sources == 2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 17:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-two-searches-using-one-field-AND-a-time-constraint/m-p/630490#M219051</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-10T17:21:08Z</dc:date>
    </item>
  </channel>
</rss>

