Splunk Search

Get Count for Each of the Values Listed

chaday00
Path Finder

I have the query below and I'm trying to get the count of hosts affected by the vulnGrouping split by priority. Whereas currently the query return the total count for both combined. 

The SPL is grouping like software by a high level name (i.e., Adobe, Cisco Software, Oracle Software, etc.), then I have applied logic to determine the Risk level. Lastly getting a count of the IPv4 addresses affected. 

| eval vulnGrouping=case(plugin_name like "Adobe%", "Adobe", plugin_name like "Google%", "Google Chrome", plugin_name like "Oracle%", "Oracle Software", plugin_name like "Cisco%", "Cisco Software")
| stats values(priority) dc(ipv4) by vulnGrouping

The output is similar to below:

vulnGroupingvalues(priority)dc(ipv4)
Adobe

Critical

High

100
Google Chrome

Critical

High

500

 

Where I'd like to be is something like this:

vulnGroupingvalues(priority)dc(ipv4)
Adobe

Critical

High

75

25

Google Chrome

Critical

High

150

350

 

Any ideas or help is greatly appreciated. 

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

@chaday00 

Do it like this

| eval vulnGrouping=case(plugin_name like "Adobe%", "Adobe", plugin_name like "Google%", "Google Chrome", plugin_name like "Oracle%", "Oracle Software", plugin_name like "Cisco%", "Cisco Software")
| stats dc(ipv4) as IPs by vulnGrouping priority
| stats list(priority) as priority list(IPs) as IPs by vulnGrouping

You must use list(X) not values(X) for each of the fields, otherwise they will not line up when aggregating on the last stats

Hope this helps

 

 

View solution in original post

somesoni2
Revered Legend

See if this format is useful for you

 

| eval vulnGrouping=case(plugin_name like "Adobe%", "Adobe", plugin_name like "Google%", "Google Chrome", plugin_name like "Oracle%", "Oracle Software", plugin_name like "Cisco%", "Cisco Software")
| chart dc(ipv4) by vulnGrouping priority

chaday00
Path Finder

This worked ok but put the High and critical into their own column. The accepted solution was more correct. Thank you so much for your suggestion 🙂

0 Karma

bowesmana
SplunkTrust
SplunkTrust

@chaday00 

Do it like this

| eval vulnGrouping=case(plugin_name like "Adobe%", "Adobe", plugin_name like "Google%", "Google Chrome", plugin_name like "Oracle%", "Oracle Software", plugin_name like "Cisco%", "Cisco Software")
| stats dc(ipv4) as IPs by vulnGrouping priority
| stats list(priority) as priority list(IPs) as IPs by vulnGrouping

You must use list(X) not values(X) for each of the fields, otherwise they will not line up when aggregating on the last stats

Hope this helps

 

 

chaday00
Path Finder

Perfect! Thank you 😊 

0 Karma
Get Updates on the Splunk Community!

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...