Group By Host in Filtered XQL Query

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Group By Host in Filtered XQL Query

L0 Member

What I want to do is generate a report showing the filtered list of CVEs on each host, multiple CVEs would show up in a single field concatenated with commas or semi-colons

dataset = va_endpoints
|arrayexpand cves
| filter CVES in (
"CVE-2019-2725", "CVE-2018-7600", "CVE-2021-44228", "CVE-2019-1653, <75 more CVEs>
)


So the current output looks like this (shortened):
endpoint_name host_count cve_name
host1 3 CVE-2019-2725
host2 3 CVE-2019-2725
host3 3 CVE-2019-2725
host2 2 CVE-2018-7600
host3 2 CVE-2018-7600
host3 1 CVE-2021-44228

It produces a report that lists each cve/endpoint combination, I was hoping to have the endpoint with the CVEs in a single field.
I see another thread (here) that says to use comp count but when I use it as "comp count(CVES) as Total_CVE_per_host by endpoint_name, CVES" I get one line per host/cve combination
I don't see how I can concatenate all the CVEs into a single field. Would the 'addrawdata' somehow be the answer?

Something like this (I could even give up the counts and just do host/cves):
endpoint_name cve_name
host1 CVE-2019-2725
host2 CVE-2019-2725,CVE-2018-7600
host3 CVE-2019-2725,CVE-2018-7600,CVE-2021-44228

1 accepted solution

Accepted Solutions

L4 Transporter

Hello @tporritt ,

 

Thanks for reaching out on LiveCommunity!

 

You can simply use below command as a sample:

dataset = va_endpoints
| arrayexpand cves
|filter cves in("CVE-2022-3515","CVE-2022-3491","CVE-2022-34903")
|comp list(cves) by endpoint_name

 

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

Ashutosh Patil

View solution in original post

1 REPLY 1

L4 Transporter

Hello @tporritt ,

 

Thanks for reaching out on LiveCommunity!

 

You can simply use below command as a sample:

dataset = va_endpoints
| arrayexpand cves
|filter cves in("CVE-2022-3515","CVE-2022-3491","CVE-2022-34903")
|comp list(cves) by endpoint_name

 

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

Ashutosh Patil
  • 1 accepted solution
  • 313 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!