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!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...