<?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: how to sort values(_time) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614529#M213580</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/189747"&gt;@klischatb&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please try like ,&lt;BR /&gt;&lt;BR /&gt;What ever the time you wanna sort, just Convert that time into "&lt;STRONG&gt;epoch",&lt;/STRONG&gt;&lt;BR /&gt;then you Can Sort that new field Consists of epoch time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thankyou.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Sep 2022 10:30:44 GMT</pubDate>
    <dc:creator>vinod743374</dc:creator>
    <dc:date>2022-09-26T10:30:44Z</dc:date>
    <item>
      <title>How to sort values(_time)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614494#M213569</link>
      <description>&lt;P&gt;Hello everyone!&lt;BR /&gt;&lt;BR /&gt;i have the following search:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="xyz" "restart"
| eval _time = strftime(_time,"%F %H:%M:%S")
| stats count as "count_of_starts" values(_time) as "restart_time" by host&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;now i get a table with the "host" "count_of_starts" "restart_time", but the time inside values is ordered like:&lt;/P&gt;
&lt;DIV class=""&gt;2022-09-22 12:19:22&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-22 12:19:46&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-22 15:02:12&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-22 15:02:36&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 11:00:51&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 11:01:16&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 15:18:10&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 15:18:34&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 15:35:47&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 15:36:11&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 16:15:05&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-23 16:15:30&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-24 09:47:43&lt;/DIV&gt;
&lt;DIV class=""&gt;2022-09-24 09:48:06&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;I need this results but in opposite order, how can i implement this?&lt;BR /&gt;&lt;BR /&gt;|sort - _time before or after stats doesn´t worked and | sort restart_time also didn´t affect the results.&lt;BR /&gt;&lt;BR /&gt;Thank you all in advance!&lt;BR /&gt;Kind regards&lt;BR /&gt;Ben&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 15:31:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614494#M213569</guid>
      <dc:creator>klischatb</dc:creator>
      <dc:date>2022-09-26T15:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to sort values(_time)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614504#M213570</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;as stats values creates a multivalve field for that restart_time you must use mvsort to this field.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/MultivalueEvalFunctions#mvsort.28X.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/MultivalueEvalFunctions#mvsort.28X.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 08:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614504#M213570</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-26T08:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to sort values(_time)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614506#M213571</link>
      <description>&lt;P&gt;If you are sure you want "restart_time" as a multivalue field, you can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval i = mvrange(0, count_of_starts)
| eval restart_time = mvmap(i, mvindex(resart_time, count_of_starts - i))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 08:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614506#M213571</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-26T08:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to sort values(_time)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614529#M213580</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/189747"&gt;@klischatb&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please try like ,&lt;BR /&gt;&lt;BR /&gt;What ever the time you wanna sort, just Convert that time into "&lt;STRONG&gt;epoch",&lt;/STRONG&gt;&lt;BR /&gt;then you Can Sort that new field Consists of epoch time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thankyou.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 10:30:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614529#M213580</guid>
      <dc:creator>vinod743374</dc:creator>
      <dc:date>2022-09-26T10:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort values(_time)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614628#M213608</link>
      <description>&lt;P&gt;Consider using list instead of values if appropriate. List will keep the original order of events returned.&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="xyz" "restart"&lt;BR /&gt;| eval _time = strftime(_time,"%F %H:%M:%S")&lt;BR /&gt;| stats count as "count_of_starts" &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;list(_time)&lt;/FONT&gt;&lt;/STRONG&gt; as "restart_time" by host&lt;/P&gt;&lt;P&gt;The caveat of using list is that it does not dedup. If dupes are a problem, you can dedup after:&lt;/P&gt;&lt;P&gt;| eval restart_time=MVDEDUP(restart_time)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If your data is not chronologically sorted, you could add&lt;/P&gt;&lt;P&gt;| sort 0 -_time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 23:16:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-time/m-p/614628#M213608</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-09-26T23:16:35Z</dc:date>
    </item>
  </channel>
</rss>

