<?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 do I sort my search events by week? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376071#M174071</link>
    <description>&lt;P&gt;@ronniemakhombi,&lt;/P&gt;

&lt;P&gt;Try using the week number in the sorting&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search|eval week_no=strftime( strptime(DATE,"%d/%m/%Y"),"%V")|sort week_no
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Dec 2018 09:50:57 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2018-12-17T09:50:57Z</dc:date>
    <item>
      <title>How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376070#M174070</link>
      <description>&lt;P&gt;I am new to Splunk. I am having a problem sorting my search results by week. I tried using the following dates as my earliest and latest dates as: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| earliest="08/06/2018" latest="30/06/2018"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following is a snippet for my events. &lt;/P&gt;

&lt;P&gt;DATE,Number,Count,Amount&lt;BR /&gt;
08/06/2018,267774,1,5&lt;BR /&gt;
08/06/2018,267721,1,5&lt;BR /&gt;
30/06/2018,2677759,1,5&lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 09:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376070#M174070</guid>
      <dc:creator>ronniemakhombi</dc:creator>
      <dc:date>2018-12-17T09:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376071#M174071</link>
      <description>&lt;P&gt;@ronniemakhombi,&lt;/P&gt;

&lt;P&gt;Try using the week number in the sorting&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search|eval week_no=strftime( strptime(DATE,"%d/%m/%Y"),"%V")|sort week_no
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Dec 2018 09:50:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376071#M174071</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-12-17T09:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376072#M174072</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
renjith, Kindly explain ( strptime(DATE,"%d/%m/%Y"),"%V").   i used it as | eval week_1=strftime( strptime(DATE,"08/06/2018"),"%V")&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 10:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376072#M174072</guid>
      <dc:creator>ronniemakhombi</dc:creator>
      <dc:date>2018-12-17T10:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376073#M174073</link>
      <description>&lt;P&gt;&lt;CODE&gt;strptime(DATE,"%d/%m/%Y")&lt;/CODE&gt; converts your DATE to an epoch time. Lets assume the field as e&lt;BR /&gt;
&lt;CODE&gt;strftime(e,"%V")&lt;/CODE&gt; extracts the week number from that.&lt;/P&gt;

&lt;P&gt;So it can  be splitted into two steps as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval time_in_epoch=strptime(DATE,"%d/%m/%Y")
|eval week_1=strftime(time_in_epoch,"%V")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 10:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376073#M174073</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-12-17T10:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376074#M174074</link>
      <description>&lt;P&gt;It worked thanx! It grouped my search results into 4. For the future, using&lt;BR /&gt;&lt;BR /&gt;
|eval time_in_epoch=strptime(DATE,"%d/%m/%Y")&lt;BR /&gt;
 |eval week_1=strftime(time_in_epoch,"%V")&lt;/P&gt;

&lt;P&gt;How can I have the results displaying week 1, week 2, week 3 and week 4. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:29:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376074#M174074</guid>
      <dc:creator>ronniemakhombi</dc:creator>
      <dc:date>2020-09-29T22:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376075#M174075</link>
      <description>&lt;P&gt;Hows your output looks like now? Are there only 4 rows and the count is per week and sorted?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 12:39:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376075#M174075</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-12-17T12:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376076#M174076</link>
      <description>&lt;P&gt;Hi Renjith. The following is the output I received from &lt;/P&gt;

&lt;P&gt;|eval time_in_epoch=strptime(DATE,"%d/%m/%Y")&lt;BR /&gt;
|eval week_1=strftime(time_in_epoch,"%V")&lt;/P&gt;

&lt;P&gt;I want to sort them as Week 1, Week 2, Week 3, Week 4&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376076#M174076</guid>
      <dc:creator>ronniemakhombi</dc:creator>
      <dc:date>2020-09-29T22:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376077#M174077</link>
      <description>&lt;P&gt;There are 4 rows and the count. These rows are as 23, 24, 25, 26 (These are not sorted), however, the count is sorted. &lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 14:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376077#M174077</guid>
      <dc:creator>ronniemakhombi</dc:creator>
      <dc:date>2018-12-17T14:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort my search events by week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376078#M174078</link>
      <description>&lt;P&gt;@ronniemakhombi,&lt;BR /&gt;
Alright. &lt;BR /&gt;
Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"your current search"|sort week_1|streamstats count as _rowno|eval week_1="Week"._rowno
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Dec 2018 14:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-my-search-events-by-week/m-p/376078#M174078</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-12-17T14:24:22Z</dc:date>
    </item>
  </channel>
</rss>

