<?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: Ordering Columns Not Working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26021#M4983</link>
    <description>&lt;P&gt;I am not sure this will work, but try putting the table command at the end of your search, listing the fields in the order that you want them to appear. Be sure to list them all!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="*90*" FeedSource Fixture&amp;gt;0 
| stats max(_time) As LatestTime By Action 
| eval Gap=time()-LatestTime 
| chart last(Gap) as lastGap by Action
| table CACHE_INSERT CACHE_UPDATE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do see some problems with this. First &lt;CODE&gt;time()&lt;/CODE&gt; is the current wall clock time - even if you want the "current" time, I would use &lt;CODE&gt;now()&lt;/CODE&gt;. &lt;CODE&gt;now()&lt;/CODE&gt; is when the search began, and so it will be consistent for all events in this search. But &lt;CODE&gt;time()&lt;/CODE&gt; will vary based on how long this search takes to run.&lt;/P&gt;

&lt;P&gt;The second problem is that your table command must list all the values of Action. If these change, then your search must be updated.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Aug 2012 21:44:40 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-08-06T21:44:40Z</dc:date>
    <item>
      <title>Ordering Columns Not Working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26020#M4982</link>
      <description>&lt;P&gt;&lt;A href="http://splunk-base.splunk.com/answers/49712/can-we-sort-command-for-sorting-the-table-records-rowwise" target="_blank"&gt;http://splunk-base.splunk.com/answers/49712/can-we-sort-command-for-sorting-the-table-records-rowwise&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have a column chart and want to order the columns. The above link isn't quite what I am looking for. My search query is as follows, and works all apart from I'd like it ordering.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="*90*" FeedSource | search Fixture&amp;gt;0 | stats max(_time) As LatestTime By Action | eval Gap=time()-LatestTime | chart last(Gap) by Action`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I order the fields such as CACHE_INSERT CACHE_UPDATE etc?&lt;/P&gt;

&lt;P&gt;Many thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26020#M4982</guid>
      <dc:creator>matthewcanty</dc:creator>
      <dc:date>2020-09-28T12:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering Columns Not Working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26021#M4983</link>
      <description>&lt;P&gt;I am not sure this will work, but try putting the table command at the end of your search, listing the fields in the order that you want them to appear. Be sure to list them all!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="*90*" FeedSource Fixture&amp;gt;0 
| stats max(_time) As LatestTime By Action 
| eval Gap=time()-LatestTime 
| chart last(Gap) as lastGap by Action
| table CACHE_INSERT CACHE_UPDATE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do see some problems with this. First &lt;CODE&gt;time()&lt;/CODE&gt; is the current wall clock time - even if you want the "current" time, I would use &lt;CODE&gt;now()&lt;/CODE&gt;. &lt;CODE&gt;now()&lt;/CODE&gt; is when the search began, and so it will be consistent for all events in this search. But &lt;CODE&gt;time()&lt;/CODE&gt; will vary based on how long this search takes to run.&lt;/P&gt;

&lt;P&gt;The second problem is that your table command must list all the values of Action. If these change, then your search must be updated.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2012 21:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26021#M4983</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-06T21:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering Columns Not Working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26022#M4984</link>
      <description>&lt;P&gt;Thanks, seems to have had the same effect as in the link I posted in my question. Also using now() in a real-time search causes the results to gradually move into greater negative values.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2012 08:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26022#M4984</guid>
      <dc:creator>matthewcanty</dc:creator>
      <dc:date>2012-08-07T08:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering Columns Not Working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26023#M4985</link>
      <description>&lt;P&gt;Sorry - didn't know this was a RT search - then time() IS a better choice.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2012 08:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26023#M4985</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-07T08:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering Columns Not Working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26024#M4986</link>
      <description>&lt;P&gt;Would it make sense to use the &lt;CODE&gt;stats&lt;/CODE&gt; command instead of the &lt;CODE&gt;chart&lt;/CODE&gt; command?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2012 08:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ordering-Columns-Not-Working/m-p/26024#M4986</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-07T08:37:18Z</dc:date>
    </item>
  </channel>
</rss>

