<?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: Table not sorted by time even after specifying the sort, what am I missing? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473679#M133269</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="
_time               breaker operation
2019-12-30 12:51:24 RH31B CLOSE-OPEN
2019-12-30 12:50:08 RH31B CLOSE-OPEN
2019-12-30 12:49:28 RH31B OPEN
2019-12-30 12:49:24 RH31B OPEN-CLOSE
2019-12-30 01:43:01 KR12B CLOSE
2019-12-30 01:42:18 KR12B OPEN
2019-12-30 01:42:16 KR12B OPEN-CLOSE
2019-12-30 01:35:12 KX12B OPEN
2019-12-30 01:35:09 KX12B CLOSE"
| multikv forceheader=1
| eval time_h=strptime(time,"%F %H:%M:%S")
| eval time_i=strptime(time,"%F %I:%M:%S")
| table time* breaker operation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @leekeener&lt;BR /&gt;
I think this situation is because the log time is recognized by &lt;CODE&gt;%H&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;You need to review the settings in &lt;CODE&gt;props.conf&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jan 2020 14:46:48 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-01-01T14:46:48Z</dc:date>
    <item>
      <title>Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473674#M133264</link>
      <description>&lt;P&gt;I have a search results I want to show in a table. I noticed that the events were not sorted by time so I added the sort _time desc. I just noticed that the time is still off as 12:00 is coming before 01:00 times. What is the fix for this? Should I not be using a table? I like how it formats the results, maybe there is another way? Here is the whole serach, this is on some Electric SCADA data to show uncommanded breaker operations.&lt;/P&gt;

&lt;P&gt;sourcetype=escada_message breaker=* AND NOT DELETED AND NOT ACKNOWLEDGD &lt;BR /&gt;
| eval cmdops=if(operation == "COMMAND TO CLOSE" OR operation == "COMMAND TO OPEN" OR operation == "CONTROL TO CLOSE" OR operation == "CONTROL TO OPEN", 1, 0) &lt;BR /&gt;
| eval uncmdops=if(operation == "OPEN" OR operation == "CLOSE" OR operation == "OPEN-CLOSE" OR operation == "CLOSE-OPEN" OR operation == "OPEN-CLOSE-OPEN" OR operation == "CLOSE-OPEN-CLOSE", 1, 0) &lt;BR /&gt;
| eval totalcmd= if(operation == "COMMAND TO CLOSE" OR operation == "COMMAND TO OPEN" OR operation == "CONTROL TO CLOSE" OR operation == "CONTROL TO OPEN" OR &lt;BR /&gt;
operation == "OPEN" OR operation == "CLOSE" OR operation == "OPEN-CLOSE" OR operation == "CLOSE-OPEN" OR operation == "OPEN-CLOSE-OPEN" OR operation == "CLOSE-OPEN-CLOSE",1,0) &lt;BR /&gt;
| eval errors=if(operation == "Clearance" OR operation == "FAIL*" OR operation == "OVERIDE*" OR operation == "SET*", 1, 0) &lt;BR /&gt;
| search uncmdops&amp;gt;0&lt;BR /&gt;
| sort - _time &lt;BR /&gt;
| table _time breaker operation&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:29:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473674#M133264</guid>
      <dc:creator>leekeener</dc:creator>
      <dc:date>2020-09-30T03:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473675#M133265</link>
      <description>&lt;P&gt;_time is a special field that exists as an integer, but is automatically displayed as text.  Sorting on _time should always result in events displaying in time sequence (ascending or descending).  Note that Splunk's default behavior is to display events in reverse chronological order (newest first) and the &lt;CODE&gt;reverse&lt;/CODE&gt; command will put them in chronological order (oldest first).&lt;/P&gt;

&lt;P&gt;If this doesn't help, please edit your question to include an example of the current output.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 16:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473675#M133265</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-12-31T16:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473676#M133266</link>
      <description>&lt;P&gt;@leekeener &lt;/P&gt;

&lt;P&gt;I'm sure &lt;CODE&gt;table&lt;/CODE&gt; is not the problem and not &lt;CODE&gt;| sort - _time&lt;/CODE&gt; as well. You can confirm it by executing below search for 5 min.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | sort - _time  | table _time _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you please share some sample events OR present output ( as screenshot) and expected output ?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 17:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473676#M133266</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-31T17:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473677#M133267</link>
      <description>&lt;P&gt;I would love to share a screenshot, however I don't see how to do so. I can provide a link to an image, but I've no means to host the image for linkiing&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 18:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473677#M133267</guid>
      <dc:creator>leekeener</dc:creator>
      <dc:date>2019-12-31T18:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473678#M133268</link>
      <description>&lt;P&gt;Thanks for the help. I agree with everything you said yet I am getting these results: Most recent event should be the 1:34am  one. I use a similar search in a bunch of reports so there was some superfluous stuff. A more concise search is at the bottom, this produced the results below.&lt;/P&gt;

&lt;P&gt;2019-12-30 12:51:24 RH31B   CLOSE-OPEN&lt;BR /&gt;
2019-12-30 12:50:08 RH31B   CLOSE-OPEN&lt;BR /&gt;
2019-12-30 12:49:28 RH31B   OPEN&lt;BR /&gt;
2019-12-30 12:49:24 RH31B   OPEN-CLOSE&lt;BR /&gt;
2019-12-30 01:43:01 KR12B   CLOSE&lt;BR /&gt;
2019-12-30 01:42:18 KR12B   OPEN&lt;BR /&gt;
2019-12-30 01:42:16 KR12B   OPEN-CLOSE&lt;BR /&gt;
2019-12-30 01:35:12 KX12B   OPEN&lt;BR /&gt;
2019-12-30 01:35:09 KX12B   CLOSE&lt;/P&gt;

&lt;P&gt;Search:&lt;BR /&gt;
sourcetype=escada_message breaker=* AND NOT DELETED AND NOT ACKNOWLEDGD &lt;BR /&gt;
| eval uncmdops=if(operation == "OPEN" OR operation == "CLOSE" OR operation == "OPEN-CLOSE" OR operation == "CLOSE-OPEN" OR operation == "OPEN-CLOSE-OPEN" OR operation == "CLOSE-OPEN-CLOSE", 1, 0) &lt;BR /&gt;
| search uncmdops&amp;gt;0&lt;BR /&gt;
| sort - _time &lt;BR /&gt;
| table _time breaker operation&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 18:54:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473678#M133268</guid>
      <dc:creator>leekeener</dc:creator>
      <dc:date>2019-12-31T18:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473679#M133269</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="
_time               breaker operation
2019-12-30 12:51:24 RH31B CLOSE-OPEN
2019-12-30 12:50:08 RH31B CLOSE-OPEN
2019-12-30 12:49:28 RH31B OPEN
2019-12-30 12:49:24 RH31B OPEN-CLOSE
2019-12-30 01:43:01 KR12B CLOSE
2019-12-30 01:42:18 KR12B OPEN
2019-12-30 01:42:16 KR12B OPEN-CLOSE
2019-12-30 01:35:12 KX12B OPEN
2019-12-30 01:35:09 KX12B CLOSE"
| multikv forceheader=1
| eval time_h=strptime(time,"%F %H:%M:%S")
| eval time_i=strptime(time,"%F %I:%M:%S")
| table time* breaker operation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @leekeener&lt;BR /&gt;
I think this situation is because the log time is recognized by &lt;CODE&gt;%H&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;You need to review the settings in &lt;CODE&gt;props.conf&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 14:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473679#M133269</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-01T14:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473680#M133270</link>
      <description>&lt;P&gt;One problem is that you should never use &lt;CODE&gt;sort&lt;/CODE&gt; without a number because doing so causes it to truncate your results set: so always use &lt;CODE&gt;sort 0&lt;/CODE&gt;.   The other problem I suspect is an admin problem with data onboarding.  Sometimes people get very lazy and use &lt;CODE&gt;DATETIME_CONFIG = CURRENT&lt;/CODE&gt; or &lt;CODE&gt;DATETIME_CONFIG = NONE&lt;/CODE&gt; because they are lazy or they desire to use the should-never-be-used &lt;CODE&gt;realtime&lt;/CODE&gt; features.  Probably this was what was done for your sourcetype and the reason that you think the events are out of order is because that is how they were indexed.  You are looking at the timestamp in the event (shown in the &lt;CODE&gt;_raw&lt;/CODE&gt; field) but that was not used for the actual timestamp.  This is just a theory; you have not given us enough detail to be conclusive.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 16:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473680#M133270</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-01-01T16:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473681#M133271</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sourcetype=escada_message (breaker=* NOT "DELETED" NOT "ACKNOWLEDGD")
| eval cmdops=if(match(operation,"(COMMAND|CONTROL) TO (CLOSE|OPEN)"), 1, 0)
| eval uncmdops=if(match(operation,"^(CLOSE|OPEN)(\-\1)?(\-\1)?"), 1, 0)
| eval totalcmd= coalesce(cmdops,uncmdops)
| eval errors=if(IN(operation,"Clearance","FAIL","OVERIDE*","SET*"), 1, 0)
| search uncmdops &amp;gt; 0
| sort - _time
| table _time breaker operation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It ’s not the purpose of the question, but the query can be written in easy way.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 22:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473681#M133271</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-01T22:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Table not sorted by time even after specifying the sort, what am I missing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473682#M133272</link>
      <description>&lt;P&gt;I figured this out and you will not believe what it was. The fix was to use strptime and format it to show AM and PM, the 12:xx times were  PM, not AM. I was quite amused by how the data was just so to prevent this from being a question you'd ask. Thanks for everyone's help.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:07:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-not-sorted-by-time-even-after-specifying-the-sort-what-am/m-p/473682#M133272</guid>
      <dc:creator>leekeener</dc:creator>
      <dc:date>2020-01-23T19:07:05Z</dc:date>
    </item>
  </channel>
</rss>

