<?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 help to sort _time in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583893#M11482</link>
    <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;why my sort _time doesnt works please?&lt;/P&gt;&lt;P&gt;what is strange is that when I click directly on the field the sort doesnt works too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval _time = strftime(_time, "%d-%m-%y %H:%M:%S") 
| sort _time 
| stats last(host) as host, last(os) as OS by _time 
| rename host as Host, _time as Date 
| table Date, Host, OS
| sort - Date&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Feb 2022 05:58:23 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2022-02-07T05:58:23Z</dc:date>
    <item>
      <title>help to sort _time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583893#M11482</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;why my sort _time doesnt works please?&lt;/P&gt;&lt;P&gt;what is strange is that when I click directly on the field the sort doesnt works too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval _time = strftime(_time, "%d-%m-%y %H:%M:%S") 
| sort _time 
| stats last(host) as host, last(os) as OS by _time 
| rename host as Host, _time as Date 
| table Date, Host, OS
| sort - Date&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 05:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583893#M11482</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2022-02-07T05:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: help to sort _time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583899#M11483</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you could possibly hitting with these,&lt;/P&gt;&lt;P&gt;sort command having 10K limit see if you are hitting the limit and&lt;/P&gt;&lt;P&gt;when you rename _time to Date it converts to epoch..&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;you are sorting | sort _time which means shows oldest on top, and again at the end | sort Date which is an epoch bring the latest events to top. check your | stats command to by _time with last() func might not give you correct context.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Appreciate an upvote if this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 06:40:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583899#M11483</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2022-02-07T06:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: help to sort _time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583900#M11484</link>
      <description>&lt;LI-CODE lang="markup"&gt;| sort 0 _time&lt;/LI-CODE&gt;&lt;P&gt;This won't hit the 10k limit.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 06:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583900#M11484</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2022-02-07T06:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: help to sort _time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583901#M11485</link>
      <description>&lt;P&gt;_time is internally stored as a number. It is a number of seconds since 1.01.1970.&lt;/P&gt;&lt;P&gt;If the field is called _time it's rendered in the UI as a string in your local timezone. (you can check it by doing&lt;/P&gt;&lt;PRE&gt;| eval mytime=_time&lt;/PRE&gt;&lt;P&gt;Since it's a number, you can normalky manipulate it (add or substract time to/from it) or sort it.&lt;/P&gt;&lt;P&gt;If you render it to text as you did in your example, you operate on strings and splunk doesn't understand that it's supposed to be a date. For splunk it's a normal string so if you sort by this field it sorts lexicographicallh which is definitelly not what you want.&lt;/P&gt;&lt;P&gt;So, to sum up - don't strftime your time fields if you want to do anything with them. If you want them to be shown in a particular way in webui, use fieldformat, not eval.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 06:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/help-to-sort-time/m-p/583901#M11485</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-07T06:42:43Z</dc:date>
    </item>
  </channel>
</rss>

