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!

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

❄️ Celebrate the season with our December lineup of Community Office Hours, Tech Talks, and Webinars! ...

Splunk and Fraud

Watch Now!Watch an insightful webinar where we delve into the innovative approaches to solving fraud using the ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...