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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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