<?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 order of subsearch results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240235#M71397</link>
    <description>&lt;P&gt;I apologize for the confusion.  But you are the MAN!!!!  It looks great now and thanks for the help.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Sep 2015 19:38:47 GMT</pubDate>
    <dc:creator>bfnpmsz</dc:creator>
    <dc:date>2015-09-25T19:38:47Z</dc:date>
    <item>
      <title>Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240231#M71393</link>
      <description>&lt;P&gt;Ok, treat me nice, please...&lt;/P&gt;

&lt;P&gt;I am working on a dashboard which totals and reports data from two different date ranges based on a date picker date range.&lt;/P&gt;

&lt;P&gt;Start: Aug. 31st to Sept. 13th.  This is my overall date range.&lt;/P&gt;

&lt;P&gt;Using the overall date range, I have calculated the first week range as follows.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;Top 5 ATM Details&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;* ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01  
[search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 earliest=$earliest$ latest=$latest$ | reverse | head 1 | addinfo | eval earliest = relative_time(info_min_time, "@w1") | fields earliest] 
[search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 earliest=$earliest$ latest=$latest$ | head 1 | addinfo | eval latest = relative_time(info_max_time, "-6d@w1") | fields latest] | top limit=5 InstanceName showperc=FALSE showcount=FALSE | sort count |
 join max=0 [search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 [search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 earliest=$earliest$ latest=$latest$ | reverse | head 1 | addinfo | eval earliest = relative_time(info_min_time, "@w1") | fields earliest] 
[search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 earliest=$earliest$ latest=$latest$ | head 1 | addinfo | eval latest = relative_time(info_max_time, "-6d@w1") | fields latest] | fields InstanceName EventName] | top  limit=5 EventName by InstanceName showperc=FALSE | reverse&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;1440997200&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;1441602000&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The data is coming back correct, but.... the order is out of sequence.&lt;/P&gt;

&lt;P&gt;My dashboard it trying to show the EventNames and count from the top 10 InstanceNames.  &lt;/P&gt;

&lt;P&gt;I am trying to replicate this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/674iEFB6546C81CD154E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;But what I am getting is this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/675i5737F161F3A2C4ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I would love to have the report come back ordered by InstanceName EventName count and then by the EventName count all desending.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;A1310-2350 total items 21&lt;/STRONG&gt;&lt;BR /&gt;
A1310-2350    ATM - A1310-2350 - Issue #1     15&lt;BR /&gt;
A1310-2350    ATM - A1310-2350 - Issue #2     3&lt;BR /&gt;
A1310-2350    ATM - A1310-2350 - Issue #3     2&lt;BR /&gt;
A1310-2350    ATM - A1310-2350 - Issue #4     1&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;A1240-2350 total items 15&lt;/STRONG&gt;&lt;BR /&gt;
A1240-2350    ATM - A1240-2350 - Issue #1     10&lt;BR /&gt;
A1240-2350    ATM - A1240-2350 - Issue #2     5&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;A1235-2350 total items 10&lt;/STRONG&gt;&lt;BR /&gt;
A1235-2350    ATM - A1235-2350 - Issue #1     8&lt;BR /&gt;
A1235-2350    ATM - A1235-2350 - Issue #2     2&lt;/P&gt;

&lt;P&gt;So as you can see, I want the report ordered by the count of InstanceName Events then by the events within InstanceName by the event count.&lt;/P&gt;

&lt;P&gt;Help me out.  I think I am CLOSE, but need a little assistance.&lt;/P&gt;

&lt;P&gt;Thanks for the help in advance&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 16:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240231#M71393</guid>
      <dc:creator>bfnpmsz</dc:creator>
      <dc:date>2015-09-25T16:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240232#M71394</link>
      <description>&lt;P&gt;Give this a try (optimized the earliest/latest calculation as well)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Updated&lt;/STRONG&gt; to correct sorting&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; * ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01 
 [ | gentimes start=-1 | addinfo | eval earliest = relative_time(info_min_time, "@w1") | eval latest = relative_time(info_max_time, "-6d@w1") | fields earliest latest ]
 | top limit=5 InstanceName showperc=FALSE showcount=FALSE
 |  join max=0 
 [search ClassName=Proview  eventtype="Notification Ticketed"  host=ALVIONIX01
 [ | gentimes start=-1 | addinfo | eval earliest = relative_time(info_min_time, "@w1") | eval latest = relative_time(info_max_time, "-6d@w1") | fields earliest latest ] | fields InstanceName EventName] 
 | top  limit=5 EventName by InstanceName showperc=FALSE | eventstats sum(count) as rank by InstanceName | eval InstanceName=tostring(rank)."##".InstanceName | fields - rank
 | appendpipe [| stats sum(count) as count by InstanceName | eval EventName="0#total items"  ]
 | sort -InstanceName EventName -count 
 | eval InstanceName=mvindex(split(InstanceName,"##"),1) | replace "0#*" with * in EventName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Sep 2015 16:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240232#M71394</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-25T16:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240233#M71395</link>
      <description>&lt;P&gt;Thanks for the quick response.  Your solution is close but I am still not getting the sequence I want.   I need ordered by InstanceName -count then EventName by -count.  &lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 18:23:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240233#M71395</guid>
      <dc:creator>bfnpmsz</dc:creator>
      <dc:date>2015-09-25T18:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240234#M71396</link>
      <description>&lt;P&gt;I got confused by you samples, they were properly sorted by both EventName and Count. Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240234#M71396</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-25T19:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240235#M71397</link>
      <description>&lt;P&gt;I apologize for the confusion.  But you are the MAN!!!!  It looks great now and thanks for the help.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240235#M71397</guid>
      <dc:creator>bfnpmsz</dc:creator>
      <dc:date>2015-09-25T19:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order of subsearch results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240236#M71398</link>
      <description>&lt;P&gt;Glad to be help of &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If there are followup question on this, please close the question by accepting the answer. Happy Splunking...&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:51:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-order-of-subsearch-results/m-p/240236#M71398</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-25T19:51:42Z</dc:date>
    </item>
  </channel>
</rss>

