<?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: trying to sort month in chronical order. Not getting the desired output in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626639#M15053</link>
    <description>&lt;P&gt;got this&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 17:02:16 GMT</pubDate>
    <dc:creator>chandankr</dc:creator>
    <dc:date>2023-01-10T17:02:16Z</dc:date>
    <item>
      <title>Trying to sort month in chronological order and not getting the desired output?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626582#M15042</link>
      <description>&lt;P&gt;was using this below Search,&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;***| rex field=_raw "&amp;lt;measResults&amp;gt;\d+\s\d+\s\d+\s\d+\s\d+\s\d+\s\d+\s\d+\s(?&amp;lt;active_state&amp;gt;\d{0,3})\s\d+\s(?&amp;lt;idle_state&amp;gt;\d{0,3})"
| eval date_month=upper(date_month)
| eventstats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by date_month
| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)
| stats count by date_month,Active_UEs,Idle_UEs
| table date_month,Active_UEs,Idle_UEs&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chandankr_1-1673354333310.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23284i7F255A6F5E7F557F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chandankr_1-1673354333310.png" alt="chandankr_1-1673354333310.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;but now&amp;nbsp; i was trying to sort&amp;nbsp;month in chronological order i used the below Search&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;***| eventstats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by date_month
| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)
| eval Month=date_month
| eval orden = if(Month="january",1,if(Month="february",2,if(Month="march",3,if(Month="april",4,if(Month="may",5,if(Month="june",6,if(Month="july",7,if(Month="august",8,if(Month="september",9,if(Month="october",10,if(Month="november",11,12)))))))))))
| sort num(Month)
| stats count by Month,Active_UEs,Idle_UEs
| table Month,Active_UEs,Idle_UEs&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chandankr_0-1673354157862.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23283iEA24D55BA2B09539/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chandankr_0-1673354157862.png" alt="chandankr_0-1673354157862.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;here also month are sorted in alphabetically order not in chronilogical order.&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>Wed, 11 Jan 2023 17:23:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626582#M15042</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-11T17:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626592#M15043</link>
      <description>&lt;P&gt;Why go through the bother of converting Month into a number and then not use it?&amp;nbsp; Sorting by orden would solve the problem, except the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command re-sorts the data.&amp;nbsp; Try this query.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;***| eventstats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by date_month
| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)
| eval Month=date_month
| eval orden = case(Month="january",1, Month="february",2, Month="march",3, Month="april",4, Month="may",5, Month="june",6, Month="july",7, Month="august",8, Month="september",9, Month="october",10, Month="november",11, 1==1, 12)
| stats count, first(Month) by orden,Active_UEs,Idle_UEs
| table Month,Active_UEs,Idle_UEs&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;BTW, the &lt;FONT face="courier new,courier"&gt;num&lt;/FONT&gt; function will not convert text ("january") into digits (1).&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 13:25:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626592#M15043</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-10T13:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626593#M15044</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252087"&gt;@chandankr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The efficient way is to create a new field to get the month number from _time field as below&lt;/P&gt;&lt;P&gt;|strftime month_num=strftime(_time,"%m")&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| stats count by Month,month_num,Active_UEs,Idle_UEs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|s&lt;/SPAN&gt;&lt;SPAN&gt;ort month_num&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If this helps, karma would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Manasa&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 13:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626593#M15044</guid>
      <dc:creator>Manasa_401</dc:creator>
      <dc:date>2023-01-10T13:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626617#M15047</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; tried that but no luck. Below is the screenshot for the same&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chandankr_0-1673366945820.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23289i3E35EA787F50C017/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chandankr_0-1673366945820.png" alt="chandankr_0-1673366945820.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626617#M15047</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-10T16:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626620#M15048</link>
      <description>&lt;P&gt;this is not working in&amp;nbsp;sort month in chronical order&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626620#M15048</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-10T16:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626622#M15049</link>
      <description>&lt;P&gt;Oops!&amp;nbsp; I left out an &lt;FONT face="courier new,courier"&gt;as&lt;/FONT&gt; clause in the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command.&amp;nbsp; Try this revision.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;***| eventstats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by date_month
| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)
| eval Month=date_month
| eval orden = case(Month="january",1, Month="february",2, Month="march",3, Month="april",4, Month="may",5, Month="june",6, Month="july",7, Month="august",8, Month="september",9, Month="october",10, Month="november",11, 1==1, 12)
| stats count, first(Month) as Month by orden,Active_UEs,Idle_UEs
| table Month,Active_UEs,Idle_UEs&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:27:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626622#M15049</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-10T16:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626624#M15050</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; also i was going through eval case and show this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;eval error_msg = case(error == 404, "Not found", error == 500, "Internal Server Error", error == 200, "OK")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/SearchReference/EvalCommandExamples" target="_blank"&gt;eval command examples - Splunk Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so i tried the below Queary&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| eval date_month=upper(date_month)&lt;BR /&gt;| eventstats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by date_month&lt;BR /&gt;| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)&lt;BR /&gt;| eval Month=date_month&lt;BR /&gt;| eval month_seq=case( Month == january, "1", Month == february, "2", Month == march, "3", Month == april, "4" , Month == may, "5" , Month == june, "6" ,&lt;BR /&gt;Month == july, "7" , Month == august, "8" , Month == september, "9" , Month == october, "10" , Month == november, "11" , Month == december, "12" )&lt;BR /&gt;| stats count, first(Month) by month_seq,Active_UEs,Idle_UEs&lt;BR /&gt;| table Month,Active_UEs,Idle_UEs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chandankr_0-1673368515451.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23290i9C94D66B4DA72275/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chandankr_0-1673368515451.png" alt="chandankr_0-1673368515451.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626624#M15050</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-10T16:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626627#M15051</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chandankr_0-1673368749739.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23292iB993B4E470CA91DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chandankr_0-1673368749739.png" alt="chandankr_0-1673368749739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;still no luck&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626627#M15051</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-10T16:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626635#M15052</link>
      <description>&lt;P&gt;In this query, the &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; statement is trying to compare the Month field to fields january, february, etc. rather than strings "january", "february", etc.&amp;nbsp; As a result, none of the cases match so month_seq is set to NULL.&amp;nbsp; When &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; is told to group by a null field it always returns no results.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 18:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626635#M15052</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-10T18:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626639#M15053</link>
      <description>&lt;P&gt;got this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:02:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626639#M15053</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-10T17:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626702#M15061</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252087"&gt;@chandankr&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try using sort after stats.&lt;/P&gt;&lt;P&gt;|sort orden&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Manasa&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626702#M15061</guid>
      <dc:creator>Manasa_401</dc:creator>
      <dc:date>2023-01-11T05:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626704#M15062</link>
      <description>&lt;P&gt;I am not sure why you are doing eventstats as well as stats. Just use bin _time to group by a monthly time span and then use _time in the stats. As stats sorts automatically it will sort by time and then you can just format time as the Month, so get rid of all the stuff from eventstats up to stats and replace with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bin _time span=1mon
| stats avg(active_state) as Active_UEs avg(idle_state) as Idle_UEs by _time 
| eval Month=strftime(_time, "%B")
| table Month,Active_UEs,Idle_UEs
| eval Active_UEs=round(Active_UEs,0), Idle_UEs=round(Idle_UEs,0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/626704#M15062</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-01-11T05:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: trying to sort month in chronical order. Not getting the desired output</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/627441#M15135</link>
      <description>&lt;P&gt;Finally got this done using below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval month=strftime(_time,"%m")&lt;BR /&gt;| eval month_name=date_month&lt;BR /&gt;| eval monthyear=date_year&lt;BR /&gt;| stats count by month,month_name,monthyear,AvgCPU,MaxCPU&lt;BR /&gt;| sort num(monthyear), num(month)&lt;BR /&gt;| table month_name,AvgCPU,MaxCPU&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 11:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Trying-to-sort-month-in-chronological-order-and-not-getting-the/m-p/627441#M15135</guid>
      <dc:creator>chandankr</dc:creator>
      <dc:date>2023-01-18T11:23:07Z</dc:date>
    </item>
  </channel>
</rss>

