Dashboards & Visualizations

How to rearrange the order of bars in a graph to display based on order of severity?

noman81
Engager

Hi,

I use the following string to display the severity of vulnerabilities with respect to count.

vulnerability_condition="" | dedup vulnerability_name,asset_name | Top vulnerability_severity | eval black=if(vulnerability_severity="critical", count, 0)| eval red=if(vulnerability_severity="high", count, 0)| eval yellow=if(vulnerability_severity="medium", count, 0) | eval blue=if(vulnerability_severity="low", count, 0) | eval green=if(vulnerability_severity="informational", count, 0) | fields - count, percent | table vulnerability_severity, black, red, yellow, blue, green | Rename vulnerability_severity As Severity, black As Critical, red As High, yellow As Medium, blue As Low, green As Informational

As a result of this search string, the bars are displayed in a Splunk dashboard panel showing the count of vulnerabilities of each severity (like critical, high medium and low). These bars are sorted in such a manner that the severity that has larger count comes first and then followed by the rest.

I want to know if there is any option available to sort them on the basis of severity like critical comes first followed by high, then medium and then low and informational at last. There is no CVSS based number available in the logs. The vulnerabilitIes in logs only tagged with their severity levels (e.g. critical, high, medium, low and informational)

0 Karma
1 Solution

gokadroid
Motivator

I will try to keep your query intact and just put a sortingSequence field in there to help you sort it and see if it works for you :

|eval sortingSequence=case(vulnerability_severity="critical", 1, vulnerability_severity="high", 2, vulnerability_severity="medium", 3, vulnerability_severity="low", 4, vulnerability_severity="informational", 5, 1=1, 0)
| sort sortingSequence

So your final search becomes as:

vulnerability_condition="" 
| dedup vulnerability_name,asset_name 
| Top vulnerability_severity 
| eval black=if(vulnerability_severity="critical", count, 0)
| eval red=if(vulnerability_severity="high", count, 0)
| eval yellow=if(vulnerability_severity="medium", count, 0) 
| eval blue=if(vulnerability_severity="low", count, 0) 
| eval green=if(vulnerability_severity="informational", count, 0) 
|eval sortingSequence=case(vulnerability_severity="critical", 1, vulnerability_severity="high", 2, vulnerability_severity="medium", 3, vulnerability_severity="low", 4, vulnerability_severity="informational", 5, 1=1, 0)
| sort sortingSequence
| fields - count, percent, sortingSequence
| table vulnerability_severity, black, red, yellow, blue, green 
| Rename vulnerability_severity As Severity, black As Critical, red As High, yellow As Medium, blue As Low, green As Informational

View solution in original post

0 Karma

gokadroid
Motivator

I will try to keep your query intact and just put a sortingSequence field in there to help you sort it and see if it works for you :

|eval sortingSequence=case(vulnerability_severity="critical", 1, vulnerability_severity="high", 2, vulnerability_severity="medium", 3, vulnerability_severity="low", 4, vulnerability_severity="informational", 5, 1=1, 0)
| sort sortingSequence

So your final search becomes as:

vulnerability_condition="" 
| dedup vulnerability_name,asset_name 
| Top vulnerability_severity 
| eval black=if(vulnerability_severity="critical", count, 0)
| eval red=if(vulnerability_severity="high", count, 0)
| eval yellow=if(vulnerability_severity="medium", count, 0) 
| eval blue=if(vulnerability_severity="low", count, 0) 
| eval green=if(vulnerability_severity="informational", count, 0) 
|eval sortingSequence=case(vulnerability_severity="critical", 1, vulnerability_severity="high", 2, vulnerability_severity="medium", 3, vulnerability_severity="low", 4, vulnerability_severity="informational", 5, 1=1, 0)
| sort sortingSequence
| fields - count, percent, sortingSequence
| table vulnerability_severity, black, red, yellow, blue, green 
| Rename vulnerability_severity As Severity, black As Critical, red As High, yellow As Medium, blue As Low, green As Informational
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...