<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sort column headers in timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165974#M47212</link>
    <description>&lt;P&gt;If this has answered your question, please mark it accepted. Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2013 16:52:06 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2013-12-04T16:52:06Z</dc:date>
    <item>
      <title>How to sort column headers in timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165968#M47206</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I've got a timechart with several columns. The headers of these columns are numbers (0,1,2,3... etc) and I would like to sort the columns ascending. With the sort command it doesn't work, perhaps somebody can help me here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:45:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165968#M47206</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2022-10-27T13:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165969#M47207</link>
      <description>&lt;P&gt;Fields can be "sorted" using the &lt;CODE&gt;fields&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | fields col0 col1 col2 col3 col4 col5&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Per &lt;CODE&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Use_proper_field_name_syntax" target="test_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Use_proper_field_name_syntax&lt;/A&gt;&lt;/CODE&gt;,  you may not have fields that begin with 0-9.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Field names cannot begin with 0-9 or _ . Leading underscores are reserved for Splunk Enterprise's internal variables.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;=EDIT=&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Based on your comment, I can say that they are sorted by numeral already, just that it is based on the beginning number. To do what you want, do this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | eval tt = case(X&amp;lt;10,"00".X,X&amp;lt;100,"0".X,1=1,X) | timechart count by tt&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Add additional case statements for each increase in the tens place, and make sure the padding is correct. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 12:23:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165969#M47207</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-12-04T12:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165970#M47208</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;

&lt;P&gt;thanks for your answer. The headers are values of a field "X", which I create during my search. The command looks like this:&lt;/P&gt;

&lt;P&gt;| timechart span=1d dc(user) by X&lt;/P&gt;

&lt;P&gt;So it's not about sorting fields, but sorting the values of field X (which are the column headers in the shown chart).&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 13:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165970#M47208</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-12-04T13:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165971#M47209</link>
      <description>&lt;P&gt;See edit above.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 15:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165971#M47209</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-12-04T15:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165972#M47210</link>
      <description>&lt;P&gt;This seems to work fine, thanks!&lt;/P&gt;

&lt;P&gt;To get sure, that I understand what I'm doing here:&lt;BR /&gt;
Could you explain why are we using a "dot" in the the Y argument? And what's the use last pair "(1=1,X)?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 15:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165972#M47210</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-12-04T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165973#M47211</link>
      <description>&lt;P&gt;The "." is combining the string "0" with the value of X. The last pair makes sure that anything not matching in the case statement will assign the value of X to the field "tt", to make sure they are all there.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 16:14:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165973#M47211</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-12-04T16:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165974#M47212</link>
      <description>&lt;P&gt;If this has answered your question, please mark it accepted. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 16:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/165974#M47212</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-12-04T16:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sort column headers in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/618512#M214978</link>
      <description>&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;CR&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 02:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-column-headers-in-timechart/m-p/618512#M214978</guid>
      <dc:creator>chakuttha</dc:creator>
      <dc:date>2022-10-27T02:33:32Z</dc:date>
    </item>
  </channel>
</rss>

