<?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 not working as expected in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478197#M134131</link>
    <description>&lt;P&gt;@gcusello Hello Sir, first of all, Happy New Year to you and your family.&lt;BR /&gt;
Here for the file, we have values like. How do they even look like they are sorted&lt;/P&gt;

&lt;P&gt;product.screen&lt;BR /&gt;
cart.do&lt;BR /&gt;
category.screen&lt;BR /&gt;
oldlink&lt;BR /&gt;
success.do&lt;BR /&gt;
passwords.pdf&lt;BR /&gt;
error.do&lt;BR /&gt;
userlist&lt;BR /&gt;
account&lt;BR /&gt;
api&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jan 2020 04:42:19 GMT</pubDate>
    <dc:creator>palisetty</dc:creator>
    <dc:date>2020-01-01T04:42:19Z</dc:date>
    <item>
      <title>sort not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478195#M134129</link>
      <description>&lt;P&gt;I used the following query where I used '-' just beside "Total bytes" without space. As per my understanding, if we have multiple fields after sort and when use '-' just next to the field that field will be sorted descending and the other fields are sorted in ascending order. But I am not getting desired results. Kindly correct me if I am wrong.&lt;/P&gt;

&lt;P&gt;index="main" host="web_application" status=200&lt;BR /&gt;
| stats sum(bytes) as "Total bytes" by file&lt;BR /&gt;
| sort -"Total bytes" file&lt;/P&gt;

&lt;P&gt;file    Total bytes&lt;BR /&gt;
product.screen  123344678&lt;BR /&gt;
cart.do 122623448&lt;BR /&gt;
category.screen 84500260&lt;BR /&gt;
oldlink 82699602&lt;BR /&gt;
success.do  67725818&lt;BR /&gt;
passwords.pdf   22207970&lt;BR /&gt;
error.do    7495294&lt;BR /&gt;
userlist    55380&lt;BR /&gt;
account 8476&lt;BR /&gt;
api 2912&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 14:17:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478195#M134129</guid>
      <dc:creator>palisetty</dc:creator>
      <dc:date>2019-12-31T14:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: sort not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478196#M134130</link>
      <description>&lt;P&gt;Hi @palisetty,&lt;BR /&gt;
it's correct: in your search you sorted at first descending by "Total bytes" (the first field with -) and then all the equal values of "Total bytes" are sorted ascending by file, so it's correct the order you have.&lt;/P&gt;

&lt;P&gt;But what's the order you want in your results?&lt;/P&gt;

&lt;P&gt;Ciao and Happy New Year.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 14:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478196#M134130</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-12-31T14:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: sort not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478197#M134131</link>
      <description>&lt;P&gt;@gcusello Hello Sir, first of all, Happy New Year to you and your family.&lt;BR /&gt;
Here for the file, we have values like. How do they even look like they are sorted&lt;/P&gt;

&lt;P&gt;product.screen&lt;BR /&gt;
cart.do&lt;BR /&gt;
category.screen&lt;BR /&gt;
oldlink&lt;BR /&gt;
success.do&lt;BR /&gt;
passwords.pdf&lt;BR /&gt;
error.do&lt;BR /&gt;
userlist&lt;BR /&gt;
account&lt;BR /&gt;
api&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 04:42:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478197#M134131</guid>
      <dc:creator>palisetty</dc:creator>
      <dc:date>2020-01-01T04:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: sort not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478198#M134132</link>
      <description>&lt;P&gt;Hi @palisetty,&lt;BR /&gt;
sorry! I was sleeping whatching that vales were sorted!&lt;BR /&gt;
Anyway, I used sort command with your data and I have a correct sort, as you can see in this example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval ppp="product.screen 123344678,cart.do 122623448,category.screen 84500260,oldlink 82699602,success.do 67725818,passwords.pdf 22207970,error.do 7495294,userlist 55380,account 8476,api 2912" 
| makemv ppp delim=","
| mvexpand ppp
| rex field=ppp "(?&amp;lt;file&amp;gt;[^ ]*)\s+(?&amp;lt;Total_bytes&amp;gt;[^ ]*)"
| table file Total_bytes
| sort -Total_bytes file
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 08:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478198#M134132</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-02T08:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: sort not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478199#M134133</link>
      <description>&lt;P&gt;can you explain what those files listed actually are for  ?  What value do they have ? &lt;BR /&gt;
product.screen&lt;BR /&gt;
cart.do&lt;BR /&gt;
category.screen&lt;BR /&gt;
oldlink&lt;BR /&gt;
success.do&lt;BR /&gt;
passwords.pdf&lt;BR /&gt;
error.do&lt;BR /&gt;
userlist&lt;BR /&gt;
account&lt;BR /&gt;
api&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 21:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-not-working-as-expected/m-p/478199#M134133</guid>
      <dc:creator>jcorcoran508</dc:creator>
      <dc:date>2020-05-14T21:16:07Z</dc:date>
    </item>
  </channel>
</rss>

