Splunk Search

How to sort columns values(Desc) for a column chart in decreasing order?

rahhali22
New Member

Hello,

I wanna know if it's possible to sort columns in decreasing order in a column chart.

Thanks in advance for your help

0 Karma

tom_frotscher
Builder

Maybe i don't understand what your problem is, but for me, this is what it does.

alt text
https://answers.splunk.com/storage/attachments/97182-no-sort.png

alt text
https://answers.splunk.com/storage/attachments/97183-sort.png

maca007
New Member

The above used to work for me. That is, simply use "sort" to order the stats under in the Statistics tab and then the Visualisation tab would graph them in the sort order.

This stopped working, I think, after an upgrade of Splunk (we are now running version 7.2.4). What I get now is Count Vs Time (aka similar to the first screen grab regardless of the sort order).

Has anyone else experienced this? And is there a work around (I simply want a graph similar to the second screen grab above)?

0 Karma

rahhali22
New Member

It doesn't work for me this is my query

   <query>index=aut_kpi2 $servicesToken$ $catalogToken$ $subscriptionToken$ | timechart span=$spanToken$ count by service_offering_name</query>
   <earliest>$timeToken.earliest$</earliest>
   <latest>$timeToken.latest$</latest
0 Karma

somesoni2
Revered Legend

There can be multiple columns based on different values of service_offering_name. Which one do you want to sort upon?

0 Karma

rahhali22
New Member

i want to sort my columns basing on the value of service_offering_name

0 Karma

somesoni2
Revered Legend

How many different values that fields can have and are they contant?? The timechart will create a field with value as the name (e.g. sourcetype=splunkd and sourcetype=scheduler , when used in timechart there will be fields named _time, splunkd and scheduler).

0 Karma

tom_frotscher
Builder

You used timechart, which is used to calculate values over time buckets. You cant reorder the time, it makes no sense. Take stats instead of timechart.

0 Karma

rahhali22
New Member

but i want something depends on date

0 Karma

rahhali22
New Member

Gooood (Y)
Thanks 🙂

0 Karma

tom_frotscher
Builder

Hi, simply put a sort command behind your search something like this:

... | sort column_name

you can control desc order with a minus:

... | sort -column_name

somesoni2
Revered Legend
0 Karma

blachow
Engager

Thank you. Exactly what I needed.
One column ranked by priority (Asc), the other by the length of the event (desc)

0 Karma

rahhali22
New Member

Actually, I want to sort the columns of column chart by value, I don't know if it's possible or not

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, ...