<?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 Searching through join results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Searching-through-join-results/m-p/676645#M231400</link>
    <description>&lt;P&gt;I've been working to recreate a query in Splunk from Microsoft Defender Endpoint that shows what files users have copied to USB Drives. The query works like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Step 1: Get all file USB Mount Events&lt;/LI&gt;&lt;LI&gt;Step 2: Get all file creation events on drives that are not C.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Step 3: Join the above two datasources by Device ID.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Step 4: Match drive letters and make sure the USB Mount time is less than File Create time.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's Microsoft's query:&amp;nbsp;&lt;A href="https://github.com/microsoft/Microsoft-365-Defender-Hunting-Queries/blob/master/Exfiltration/Files%20copied%20to%20USB%20drives.md" target="_blank" rel="noopener"&gt;Microsoft-365-Defender-Hunting-Queries/Exfiltration/Files copied to USB drives.md at master · microsoft/Microsoft-365-Defender-Hunting-Queries · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In Splunk I get to step three and then I'm not able to filter values based on that. Below is my query so far. Any suggestions would be helpful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=atp category="AdvancedHunting-DeviceFileEvents" properties.InitiatingProcessAccountName!="system" properties.ActionType="FileCreated" properties.FolderPath!="C:\\*" properties.FolderPath!="\\*"&lt;BR /&gt;| fields properties.ReportId, properties.DeviceId, properties.InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn, properties.FileName, properties.FolderPath, properties.SHA256, properties.Timestamp, properties.SensitivityLabel, properties.IsAzureInfoProtectionApplied&lt;BR /&gt;| rename properties.ReportId as ReportId, properties.DeviceId as DeviceId, properties.InitiatingProcessAccountDomain as InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName as InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn as InitiatingProcessAccountUpn, properties.FileName as FileName, properties.FolderPath as FolderPath, properties.SHA256 as SHA256, properties.Timestamp as Timestamp, properties.SensitivityLabel as SensitivityLabel, properties.IsAzureInfoProtectionApplied as IsAzureInfoProtectionApplied&lt;BR /&gt;| eval Timestamp_epoch = strptime (Timestamp, "%Y-%m-%dT%H:%M:%S.%6N%Z")&lt;BR /&gt;| sort DeviceId, Timestamp desc&lt;BR /&gt;| join type=inner left=L right=R where L.DeviceId = R.DeviceId&lt;BR /&gt;[search index=atp category="AdvancedHunting-DeviceEvents" properties.ActionType="UsbDriveMounted" | spath input=properties.AdditionalFields | fields properties.DeviceId, properties.DeviceName, DriveLetter, properties.Timestamp, ProductName, SerialNumber, Manufacturer | sort properties.DeviceId, properties.Timestamp desc&lt;BR /&gt;| rename properties.DeviceId as DeviceId, properties.DeviceName as DeviceName, properties.Timestamp as MountTime&lt;BR /&gt;| eval MountTime_epoch = strptime (MountTime, "%Y-%m-%dT%H:%M:%S.%6N%Z") ]&lt;BR /&gt;| table L.FolderPath,R.DriveLetter, R.MountTime, R.MountTime_epoch, L.Timestamp, L.Timestamp_epoch&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&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>Mon, 05 Feb 2024 20:34:44 GMT</pubDate>
    <dc:creator>pcookhayboo</dc:creator>
    <dc:date>2024-02-05T20:34:44Z</dc:date>
    <item>
      <title>Searching through join results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-through-join-results/m-p/676645#M231400</link>
      <description>&lt;P&gt;I've been working to recreate a query in Splunk from Microsoft Defender Endpoint that shows what files users have copied to USB Drives. The query works like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Step 1: Get all file USB Mount Events&lt;/LI&gt;&lt;LI&gt;Step 2: Get all file creation events on drives that are not C.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Step 3: Join the above two datasources by Device ID.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Step 4: Match drive letters and make sure the USB Mount time is less than File Create time.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's Microsoft's query:&amp;nbsp;&lt;A href="https://github.com/microsoft/Microsoft-365-Defender-Hunting-Queries/blob/master/Exfiltration/Files%20copied%20to%20USB%20drives.md" target="_blank" rel="noopener"&gt;Microsoft-365-Defender-Hunting-Queries/Exfiltration/Files copied to USB drives.md at master · microsoft/Microsoft-365-Defender-Hunting-Queries · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In Splunk I get to step three and then I'm not able to filter values based on that. Below is my query so far. Any suggestions would be helpful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=atp category="AdvancedHunting-DeviceFileEvents" properties.InitiatingProcessAccountName!="system" properties.ActionType="FileCreated" properties.FolderPath!="C:\\*" properties.FolderPath!="\\*"&lt;BR /&gt;| fields properties.ReportId, properties.DeviceId, properties.InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn, properties.FileName, properties.FolderPath, properties.SHA256, properties.Timestamp, properties.SensitivityLabel, properties.IsAzureInfoProtectionApplied&lt;BR /&gt;| rename properties.ReportId as ReportId, properties.DeviceId as DeviceId, properties.InitiatingProcessAccountDomain as InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName as InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn as InitiatingProcessAccountUpn, properties.FileName as FileName, properties.FolderPath as FolderPath, properties.SHA256 as SHA256, properties.Timestamp as Timestamp, properties.SensitivityLabel as SensitivityLabel, properties.IsAzureInfoProtectionApplied as IsAzureInfoProtectionApplied&lt;BR /&gt;| eval Timestamp_epoch = strptime (Timestamp, "%Y-%m-%dT%H:%M:%S.%6N%Z")&lt;BR /&gt;| sort DeviceId, Timestamp desc&lt;BR /&gt;| join type=inner left=L right=R where L.DeviceId = R.DeviceId&lt;BR /&gt;[search index=atp category="AdvancedHunting-DeviceEvents" properties.ActionType="UsbDriveMounted" | spath input=properties.AdditionalFields | fields properties.DeviceId, properties.DeviceName, DriveLetter, properties.Timestamp, ProductName, SerialNumber, Manufacturer | sort properties.DeviceId, properties.Timestamp desc&lt;BR /&gt;| rename properties.DeviceId as DeviceId, properties.DeviceName as DeviceName, properties.Timestamp as MountTime&lt;BR /&gt;| eval MountTime_epoch = strptime (MountTime, "%Y-%m-%dT%H:%M:%S.%6N%Z") ]&lt;BR /&gt;| table L.FolderPath,R.DriveLetter, R.MountTime, R.MountTime_epoch, L.Timestamp, L.Timestamp_epoch&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&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>Mon, 05 Feb 2024 20:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-through-join-results/m-p/676645#M231400</guid>
      <dc:creator>pcookhayboo</dc:creator>
      <dc:date>2024-02-05T20:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Searching through join results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-through-join-results/m-p/676695#M231416</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=atp category="AdvancedHunting-DeviceFileEvents"
  ( (properties.InitiatingProcessAccountName!="system" properties.ActionType="FileCreated" properties.FolderPath!="C:\\*" properties.FolderPath!="\\*")
  OR (category="AdvancedHunting-DeviceEvents" properties.ActionType="UsbDriveMounted") )
| spath input=properties.AdditionalFields
| fields properties.ReportId, properties.DeviceId, properties.InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn, properties.FileName, properties.FolderPath, properties.SHA256, properties.Timestamp, properties.SensitivityLabel, properties.IsAzureInfoProtectionApplied properties.DeviceName, DriveLetter, properties.Timestamp, ProductName, SerialNumber, Manufacturer
| rename properties.ReportId as ReportId, properties.DeviceId as DeviceId, properties.InitiatingProcessAccountDomain as InitiatingProcessAccountDomain, properties.InitiatingProcessAccountName as InitiatingProcessAccountName, properties.InitiatingProcessAccountUpn as InitiatingProcessAccountUpn, properties.FileName as FileName, properties.FolderPath as FolderPath, properties.SHA256 as SHA256, properties.Timestamp as Timestamp, properties.SensitivityLabel as SensitivityLabel, properties.IsAzureInfoProtectionApplied as IsAzureInfoProtectionApplied, properties.DeviceName as DeviceName, properties.Timestamp as MountTime
| eval Timestamp_epoch = strptime (Timestamp, "%Y-%m-%dT%H:%M:%S.%6N%Z")
| eval MountTime_epoch = strptime (MountTime, "%Y-%m-%dT%H:%M:%S.%6N%Z")
| sort Timestamp MountTime
| stats list(FolderPath) as FolderPath, list(DriveLetter) as DriveLetter, list(MountTime) as MountTime, list(MountTime_epoch) as MountTime_epoch, list(Timestamp) as Timestamp, list(Timestamp_epoch) as Timestamp_epoch by DeviceId&lt;/LI-CODE&gt;&lt;P&gt;Not sure what the real question/difficulty is. &amp;nbsp;The above really performs the same task as your join, just more efficient with stats.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 07:48:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-through-join-results/m-p/676695#M231416</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-02-06T07:48:59Z</dc:date>
    </item>
  </channel>
</rss>

