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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...