Splunk Search

Sorting Multivalue Stacked Bar Chart

aaronkorn
Splunk Employee
Splunk Employee

Anyone have an idea to sort a multivalued stacked bar chart based on the value? I already tried | sort -Size.

The search is: index=sccm Size>0 | chart avg(Size) by Directory, SiteCode

0 Karma

lguinn2
Legend

Okay, based on your post, I would run the search this way:

index=sccm Size>0 
| chart avg(Size) as AvgSize by SiteCode
| sort -AvgSize
0 Karma

aaronkorn
Splunk Employee
Splunk Employee

We are not applying a sum to the site code. The site code simply acts as an identifier for different sources of data. The point of this graph is to show the average directory size per SiteCode to notice size differences..

0 Karma

lguinn2
Legend

Hmm, if you want to add up the average sizes of the SiteCodes and sort by the total, you will need to know the values of the site codes. For my example, I will ensure that the values of the site codes all begin with "SiteCode:"

index=sccm Size>0 
| eval SiteCode = "SiteCode:" + SiteCode
| chart avg(Size) as AvgSize by Directory, SiteCode
| addtotals fieldname=TotalAvg SiteCode*
| sort -TotalAvg
| fields - TotalAvg

I may not really understand the question, though.

And I do question the statistical validity of any chart that sums (or stacks) averages...

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...