Dashboards & Visualizations

Vulnerbilities Pie-chart on Dashboard (Qualys)

NewSplunkUserX
New Member

I am trying to create a real time pie-chart for vulnerable PC's in my environment.

I start with a simple query like:

index=qualys (STATUS=NEW OR RE-OPENED OR ACTIVE) | ...

However, most of the PC names start with same letters like IN, PH, etc. How to group them together in the pie-chart?

 

Labels (1)
0 Karma

niketn
Legend

@NewSplunkUserX  try the following SPL

 

 

index=qualys (STATUS=NEW OR RE-OPENED OR ACTIVE) 
| stats count by NETBIOS
| eval GROUP=substr(NETBIOS,1,2)
| stats sum(count) as count by GROUP

 

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

to4kawa
Ultra Champion

sample:

index=_internal | head 100 | fields _time _raw | eval _raw="NETBIOS=".mvindex(split("AU,SN,TW,BK",","),random() % 4)."0".(random() % 9 + 1)."TTW "._time
| kv
| rename COMMENT as "this is sample. please check it. from here, the logic."
| rex field=NETBIOS "(?<group>\w\w)"
| stats count by group

recommend:

index=qualys (STATUS=NEW OR RE-OPENED OR ACTIVE) 
| rex field=NETBIOS "(?<group>\w\w)"
| stats count by group

please check sample code.

0 Karma

niketn
Legend

@to4kawa  Purpose for my stats first and field extract later was to reduce field extraction on number of events. A derivative of the following search optimization technique 🙂https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup#Optimizing_your_lookup_se...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

to4kawa
Ultra Champion

please provide samples.

0 Karma

NewSplunkUserX
New Member

index=qualys (STATUS=NEW OR RE-OPENED OR ACTIVE) | stats count by NETBIOS

So all values starting with AU should make one part of the pie-chart. Similarly for others SN, TW, BK.

Output:

NETBIOS

AU09TTW

AU09TTW

SN09TTW

BK09TTW

BK09TTW

BK09TTW

SN09TTW

TW09TTW

TW09TTW

.

.

.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...