Cortex XQL "Let" replacement

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

Cortex XQL "Let" replacement

L0 Member

Hi, 

 

I'm wondering if anybody knows a method, I can use to join multiple queries within the same XQL query. 

I have 3 separate queries which return a count of vulnerabilities for each region of logs. How do i merge these 3 queries to return a table which shows 

 

UKI 1 

CAN  1

AUS  1


I know this was possible with Sentinel KQL as you could nest queries in let functions.. is it possible with XQL?

Kind regards, 

 

 

For example: 

 

dataset = va_cves
| arrayexpand affected_hosts
| join (preset = host_inventory_endpoints | filter group_names contains "UKI" | fields endpoint_name, group_names ) as edr edr.endpoint_name = affected_hosts
| fields endpoint_name , group_names , name , description , exploitability_score , impact_score

| comp count(endpoint_name ) as count

 

dataset = va_cves
| arrayexpand affected_hosts
| join (preset = host_inventory_endpoints | filter group_names contains "CAN" | fields endpoint_name, group_names ) as edr edr.endpoint_name = affected_hosts
| fields endpoint_name , group_names , name , description , exploitability_score , impact_score

| comp count(endpoint_name ) as count

 

dataset = va_cves
| arrayexpand affected_hosts
| join (preset = host_inventory_endpoints | filter group_names contains "UKI" | fields endpoint_name, group_names ) as edr edr.endpoint_name = affected_hosts
| fields endpoint_name , group_names , name , description , exploitability_score , impact_score

| comp count(endpoint_name ) as count

1 REPLY 1

L5 Sessionator

Hi @KCaudwell 

 

dataset = va_cves
| arrayexpand affected_hosts
| join (preset = host_inventory_endpoints | filter group_names in ("UKI", "CAN", "AUS") | fields endpoint_name, group_names ) as edr edr.endpoint_name = affected_hosts
| fields endpoint_name , group_names , name , description , exploitability_score , impact_score

| comp count(endpoint_name ) as count

 

 

or maybe 

 

dataset = va_cves
| arrayexpand affected_hosts
| join (preset = host_inventory_endpoints | filter group_names contains "UKI"  OR group_names contains "AUS" OR group_name contains "CAN" | fields endpoint_name, group_names ) as edr edr.endpoint_name = affected_hosts
| fields endpoint_name , group_names , name , description , exploitability_score , impact_score
| comp count(endpoint_name ) as count

 

 

Please let me know if the former worked for you

 

If you feel this has answered your query, please let us know by clicking like and on "mark this as a Solution". Thank you.

 

KR,

Luis

  • 366 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!