Splunk Search

Using Stats Average and Count to Display my Results

Makinde
New Member

Hi All,

I have a search string that reports three fields, Server name, Vulnerability and Severity (in numbers from 1 to 5).

So it is possible one server could have multiple vulnerability and each vulnerability has a severity in numbers

I would like to display my result by counting the number of times each server appears in my results which would mean that's the number of vulnerabilities found on that server, keep in mind each vulnerability found on that server has a severity, then I would like to do an average of all the severity for the vulnerabilities found on each server. so the result looks like

Server Name Count Average Severity
Server1 12 2.5
Server2 9 3.4
Server3 24 3.8

I have search strings that can generate Server_Name and Count and another one to generate Server Name and Average Severity but I need to know how to combine it so they can all be displayed in one table.

Here are the two different search strings;

index=main | stats count by Server_Name

index=main | stats avg(severity) by Server_Name

How can I get both search stirngs to become one and display both information correctly as described above?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Combine the two stats commands into one.

index=main | stats count(severity) as Count avg(severity) as Average by Server_Name
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Combine the two stats commands into one.

index=main | stats count(severity) as Count avg(severity) as Average by Server_Name
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...