Summarise XQL results by hostname

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

Summarise XQL results by hostname

L1 Bithead

Is it possible to group\count\summarise results from an XQL query by hostname rather than seeing every entry for every event?

 

for example:

dataset = xdr_data
| filter event_type = FILE and
actor_process_image_name contains "Something" 

 

is there someway I can just summarise or count the number of events per hostname rather than output every event that has the file "something" in it?

1 accepted solution

Accepted Solutions

L2 Linker

Hi @ianatgrafton 

You can do that by using the comp stage with its count function (sometimes you will need to use count_distinct based on the use case you are trying to accomplish ) - Reference here - https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/count 

to your query above, you can write something like the below to count the actor images per hostname, and sort by the count in descending manner :

dataset = xdr_data
| filter event_type = FILE and
actor_process_image_name contains ".exe"
| comp count(actor_process_image_name ) as Image_count by agent_hostname , actor_process_image_name
| sort desc Image_count

Hope that was helpful and shed some light, please feel free to accept this as a solution if it answers your question so others can benefit from.

Best,
Z

Z

View solution in original post

1 REPLY 1

L2 Linker

Hi @ianatgrafton 

You can do that by using the comp stage with its count function (sometimes you will need to use count_distinct based on the use case you are trying to accomplish ) - Reference here - https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/count 

to your query above, you can write something like the below to count the actor images per hostname, and sort by the count in descending manner :

dataset = xdr_data
| filter event_type = FILE and
actor_process_image_name contains ".exe"
| comp count(actor_process_image_name ) as Image_count by agent_hostname , actor_process_image_name
| sort desc Image_count

Hope that was helpful and shed some light, please feel free to accept this as a solution if it answers your question so others can benefit from.

Best,
Z

Z
  • 1 accepted solution
  • 1097 Views
  • 1 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!