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!

Meet Duke Cyberwalker | A hero’s journey with Splunk

We like to say, the lightsaber is to Luke as Splunk is to Duke. Curious yet? Then read Eric Fusilero’s latest ...

The Future of Splunk Search is Here - See What’s New!

We’re excited to introduce two powerful new search features, now generally available for Splunk Cloud Platform ...

Splunk is Nurturing Tomorrow’s Cybersecurity Leaders Today

Meet Carol Wright. She leads the Splunk Academic Alliance program at Splunk. The Splunk Academic Alliance ...