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!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...