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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...