Splunk Search

How to display percentage rather than count of a field with multiple values on a timechart?

bruceclarke
Contributor

Hey all,

I've seen some similar questions around this, but none are quite what I want. I have a field with >10 values that I want to display the percentage of total for each value using a timechart. Right now I can easily get the count by doing something like [baseSearch] | timechart count by myField.

The problem that I have is that there's no good way to append the total count to get the percentage. I tried using the appendCols function, but my columns don't appear to be lining up correctly. I'm seeing zero values for total count when the "count by" is non-zero and vice versa.

Does anyone know how I can display the percentage over time rather than the count?

Thanks!

1 Solution

somesoni2
Revered Legend

Try this

your base search  | timechart count by myField | untable _time myField count | eventstats sum(count) as Total by _time | eval perc=round(count*100/Total,2) | table _time myField perc | xyseries _time myfield perc

View solution in original post

somesoni2
Revered Legend

Try this

your base search  | timechart count by myField | untable _time myField count | eventstats sum(count) as Total by _time | eval perc=round(count*100/Total,2) | table _time myField perc | xyseries _time myfield perc
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...