<?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: Sort Date in header in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352741#M104416</link>
    <description>&lt;P&gt;Good to know, to me join on same index and then xyseries along with two times transpose seemed excessive effort &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; So wanted to see if what is the output you wanted and whether there was any other way. In any case do post your final query which fixed the issue and accept the same as answer. This will mark your question as answered and also help the community.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 09:55:07 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-02-02T09:55:07Z</dc:date>
    <item>
      <title>Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352737#M104412</link>
      <description>&lt;P&gt;I don't know what's wrong with my code. I cannot sort the date using sort. &lt;BR /&gt;
Below is my code. I need to sort it by Date. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="sharepoint_capacity"
| fields - _raw 
| fields "Resource Name" "Capacity End Date" "Capacity Start Date" EID FTE "Project Name" ID 
| stats count by "Resource Name" FTE "Project Name"
| rename FTE as Allocation 
| join
    [search index="sharepoint_capacity" 
    |eval epoch_end=strptime('Capacity End Date',"%m/%d/%Y"), epoch_start=strptime('Capacity Start Date',"%m/%d/%Y"), between=mvrange(epoch_start,epoch_end,"1d") 
| mvexpand between 
| eval _time=between 
| stats values(FTE) as alloc by "Resource Name" FTE "Project Name" _time
| eval months=strftime(_time,"%B %d %Y") 
| xyseries "Resource Name" months alloc
| transpose 0 header_field="Resource Name" 
| rename column as Month
| eval getmonth=strptime(Month,"%B %d %Y")
| sort getmonth
| transpose 0 header_field=Month 
| rename column as "Resource Name"]
| fields - count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 09:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352737#M104412</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-01T09:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352738#M104413</link>
      <description>&lt;P&gt;You are sorting in the subsearch not in den main search, try an do the sort in the main search.&lt;BR /&gt;
To get a formated search in Splunk&amp;gt; just hit Ctrl+F in the inputbox for formatting.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="sharepoint_capacity" 
| fields - _raw 
| fields "Resource Name" "Capacity End Date" "Capacity Start Date" EID FTE "Project Name" ID 
| stats count by "Resource Name" FTE "Project Name" 
| rename FTE as Allocation 
| join 
    [ search index="sharepoint_capacity" 
    | eval epoch_end=strptime('Capacity End Date',"%m/%d/%Y"), epoch_start=strptime('Capacity Start Date',"%m/%d/%Y"), between=mvrange(epoch_start,epoch_end,"1d") 
    | mvexpand between 
    | eval _time=between 
    | stats values(FTE) as alloc by "Resource Name" FTE "Project Name" _time 
    | eval months=strftime(_time,"%B %d %Y") 
    | xyseries "Resource Name" months alloc 
    | transpose 0 header_field="Resource Name" 
    | rename column as Month 
    | eval getmonth=strptime(Month,"%B %d %Y") 
    | transpose 0 header_field=Month 
    | rename column as "Resource Name"] 
| sort getmonth 
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 09:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352738#M104413</guid>
      <dc:creator>Elsurion</dc:creator>
      <dc:date>2018-02-02T09:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352739#M104414</link>
      <description>&lt;P&gt;@katrinamara do you mind sharing some mocked up sample events and also the current output vs desired output?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 09:39:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352739#M104414</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-02T09:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352740#M104415</link>
      <description>&lt;P&gt;Hi, already done resolving this issue. thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 09:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352740#M104415</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-02T09:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352741#M104416</link>
      <description>&lt;P&gt;Good to know, to me join on same index and then xyseries along with two times transpose seemed excessive effort &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; So wanted to see if what is the output you wanted and whether there was any other way. In any case do post your final query which fixed the issue and accept the same as answer. This will mark your question as answered and also help the community.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 09:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352741#M104416</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-02T09:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352742#M104417</link>
      <description>&lt;P&gt;Here's my final query which fixed my issue. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="sharepoint_capacity"
| fields - _raw 
| fields "Resource Name" "Capacity End Date" "Capacity Start Date" EID FTE "Project Name" ID 
| stats count by "Resource Name" FTE "Project Name"
| rename FTE as Allocation 
| join
    [search index="sharepoint_capacity" 
    |eval epoch_end=strptime('Capacity End Date',"%m/%d/%Y"), epoch_start=strptime('Capacity Start Date',"%m/%d/%Y"), between=mvrange(epoch_start,epoch_end,"1d") 
| mvexpand between 
| eval _time=between 
| stats values(FTE) as alloc by "Resource Name" FTE "Project Name" _time
| eval months=strftime(_time,"%B %d %Y") 
| xyseries "Resource Name" months alloc]
| fields - count 
| transpose 0
| eval column1=column, getmonth=strptime(column1,"%B %d %Y") 
| fillnull value=1 getmonth
| sort getmonth
| fields - column1 getmonth
| transpose 0 header_field=column 
| fields - column
| sort "Resource Name"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 09:57:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352742#M104417</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-02T09:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Date in header</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352743#M104418</link>
      <description>&lt;P&gt;@katrinamara if your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 12:41:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Date-in-header/m-p/352743#M104418</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-02-02T12:41:45Z</dc:date>
    </item>
  </channel>
</rss>

