Splunk Search

Pie Chart Query

hhopkins
Engager

I have created pie charts with data like this:
index=default counter=10 color=blue
index=default counter=5 color=green
index=default counter=2 color=red

My pie chart query would be:
index=default | stats sum(counter) by color

That works fine, but what if I want the same result but my data looks like this?
index=default bluecounter=10 greencounter=5 redcounter=2

I can't figure out how to make the stats query to show the same breakdown by color.

Tags (3)
0 Karma

Kate_Lawrence-G
Contributor

Hi,

The way you have it now you can't report by color since color (and counter) aren't really defined anymore.

If your stuck with the data in that format you would have to do a rex and pull out the field manually

(*note that is written for _raw and will be different if *counter are actually defined fields - more on rex here)

rex (?"(\w+)counter" | rex
(?="(\d+)" | stats
sum(counter) by color

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...