Enhanced Security Measures in Place:   To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.

Use 2 datasets in the same XQL query

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Use 2 datasets in the same XQL query

L1 Bithead

Hello, I would like to be able to use the dataset “xdr_data & endpoint” in the same query.


Here's my query : 

 

dataset = xdr_data
| filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_OPEN
| alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"), Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"), Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"), Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number") // Getting details about the device a file was created on
| filter drive_type = "2" // Filtering by drive type 2 which is 'Removable Media'
| fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number

 

This query displays all the files that have been opened from a USB stick. I'd like to be able to display the tags and endpoint groups of the endpoints in the fields, so that I can sort as I wish and get exactly what I'm looking for.

 

if anyone has a solution I'm interested 🙂

Cortex XDR 

2 accepted solutions

Accepted Solutions

L5 Sessionator

Hi @CyrilBondenetVC, thanks for reaching us using the Live Community.

 

You need to use the Join stage in the XQL to look for the agent hostname between both datasets.

 

Try this query:

 

dataset = xdr_data
| filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_OPEN
| alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"), Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"), Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"), Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number") // Getting details about the device a file was created on
| filter drive_type = "2" // Filtering by drive type 2 which is 'Removable Media'
| join (dataset = endpoints | fields group_names as GroupNames, tags as Tags, endpoint_name as EndpointName ) as endpoints endpoints.EndpointName = agent_hostname
| fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number, agent_hostname, GroupNames, Tags

 

If this post answers your question, please mark it as the solution.

JM

View solution in original post

Take a look at this, hope it helps:

 

jmazzeo_1-1731610176674.png

 

You have more details in the linked doc in my previous post.

JM

View solution in original post

4 REPLIES 4

L5 Sessionator

Hi @CyrilBondenetVC, thanks for reaching us using the Live Community.

 

You need to use the Join stage in the XQL to look for the agent hostname between both datasets.

 

Try this query:

 

dataset = xdr_data
| filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_OPEN
| alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"), Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"), Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"), Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number") // Getting details about the device a file was created on
| filter drive_type = "2" // Filtering by drive type 2 which is 'Removable Media'
| join (dataset = endpoints | fields group_names as GroupNames, tags as Tags, endpoint_name as EndpointName ) as endpoints endpoints.EndpointName = agent_hostname
| fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number, agent_hostname, GroupNames, Tags

 

If this post answers your question, please mark it as the solution.

JM

L1 Bithead

Thank you very much. That's exactly what I needed. 

 

In order to understand better, could you explain to me what this part corresponds to?

as endpoints endpoints.EndpointName = agent_hostname

 Regards,

Take a look at this, hope it helps:

 

jmazzeo_1-1731610176674.png

 

You have more details in the linked doc in my previous post.

JM

L1 Bithead

Hello,

 

I understand better now, thank you for taking the time to answer my questions.

 

I think it will help a lot of people 🙂

 

Regards,

  • 2 accepted solutions
  • 274 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!