Splunk Search

Re-order table columns with dynamic names?

mspoerr
Path Finder

Hello,

I have a chart with dynamic field names displayed as table and would like to change the order of the columns:

 

 

Name     Season 1     Season 2     Season 3
Name1    10000        11111        22222
Name2    9999         9997         9998
Name3    7777         5555         6666

 

 

How can I change the order of the columns? The number of Seasons is flexible and it should always start with the latest one -> Name  Season3  Season2  Season1

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| transpose 0 header_field=Name column_name=Name
| sort 0 - Name
| transpose 0 header_field=Name column_name=Name

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| transpose 0 header_field=Name column_name=Name
| sort 0 - Name
| transpose 0 header_field=Name column_name=Name

mspoerr
Path Finder

Is it possible to get more control over the sorting? There are more columns which I omitted in my original question.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Sort of non-numeric fields is done lexicographically. It can be ascending or descending. If you want the columns sorted another way, you may have to add another field, possibly based on the name, which can then be sorted by, and then removed.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...