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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...