Splunk Search

sort the columns numerically in table *

smiththebest
New Member

mySearch | table * generates nice table of all my ~150 fields with default field names field1 field2... field10... fiel100 field101 so on but the output Table columns are ordered alphabetically meaning field1 field10 field100 field101 so on. How can I order the columns so the table show field1 field2 field3.... ?
Thank you

Tags (1)
0 Karma

koshyk
Super Champion

Splunk is doing correctly, coz field1, field10,field2 i correct ordering.
The only way i could think of is to "pad" your field names with zeroes, so it becomes
field001, field002,field003... , field010,field011.... field100,field101 etc

Inroder to do that
1. Do it manually one time (may be easier here).=> Just put each field to do rename eg: |rename field1 as field001 and put as a macro . So your search should be . => ...| rename_my_fields| table field*
2. Do using some kind of regex to pad ....|foreach field* [eval newfield=<<FIELD>>] table field*

Get Updates on the Splunk Community!

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...