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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 GA in US-AWS!

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