Splunk Search

How to group results by name

marina_rovira
Contributor

Hello all,

I have a search with these results
compl count(Number)
0 1
p1-compliant 5
p1-no-compliant 3
p2-compliant 4
p3-compliant 5
p3-no-compliant 5

and the graphic visualization is like this one:
alt text

However, I would like to present it group by priorities as
P0
p1 -> compliant and non-complaint
p2 -> compliant and non-complaint
p3 -> compliant and non-complaint
p4 -> compliant and non-complaint

in a graphic like this, were there are two bars for one value, as seying the compliant and not compliant bars together for the same prority:
alt text

Do you know if it's possible to group it by prorities?

Thank you in advance!

0 Karma
1 Solution

javiergn
Super Champion

Assuming the following CSV:

compl,Number
0,1
p1-compliant,5
p1-no-compliant,3
p2-compliant,4
p3-compliant,5
p3-no-compliant,5

This is what I've done:

| inputcsv mycsv.csv
| rex field=compl "^(?<priority>p\d)\-(?<compliance>.+)$"
| where isnotnull(compliance)
| chart values(Number) as count over priority by compliance

And the output:

alt text

View solution in original post

fdi01
Motivator

try like :

...| chart count(Number) as count over priority by compliance

javiergn
Super Champion

Assuming the following CSV:

compl,Number
0,1
p1-compliant,5
p1-no-compliant,3
p2-compliant,4
p3-compliant,5
p3-no-compliant,5

This is what I've done:

| inputcsv mycsv.csv
| rex field=compl "^(?<priority>p\d)\-(?<compliance>.+)$"
| where isnotnull(compliance)
| chart values(Number) as count over priority by compliance

And the output:

alt text

Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...