<?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 to sort the output baed on time and host? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32389#M5762</link>
    <description>&lt;P&gt;I also tried '| sort _time' and I get no results.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jan 2011 00:33:42 GMT</pubDate>
    <dc:creator>shahhe</dc:creator>
    <dc:date>2011-01-27T00:33:42Z</dc:date>
    <item>
      <title>How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32386#M5759</link>
      <description>&lt;P&gt;How can I order the results by time (_time + _subsecond fields) and then by host field?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2011 05:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32386#M5759</guid>
      <dc:creator>shahhe</dc:creator>
      <dc:date>2011-01-26T05:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32387#M5760</link>
      <description>&lt;P&gt;Try appending this to your search string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort -_time +host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will sort in descending time order, then ascending host order&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2011 21:03:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32387#M5760</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2011-01-26T21:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32388#M5761</link>
      <description>&lt;P&gt;Thanks for the answer. &lt;BR /&gt;
This query returns rows in descending order.&lt;BR /&gt;
How do I sort in ascending order by time?&lt;BR /&gt;
When I use +_time I get nothing.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2011 22:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32388#M5761</guid>
      <dc:creator>shahhe</dc:creator>
      <dc:date>2011-01-26T22:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32389#M5762</link>
      <description>&lt;P&gt;I also tried '| sort _time' and I get no results.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2011 00:33:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32389#M5762</guid>
      <dc:creator>shahhe</dc:creator>
      <dc:date>2011-01-27T00:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32390#M5763</link>
      <description>&lt;P&gt;Could you post your complete search string?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2011 00:41:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32390#M5763</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2011-01-27T00:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32391#M5764</link>
      <description>&lt;P&gt;sourcetype="retrans" daysago="1" WARNING | sort _time&lt;/P&gt;

&lt;P&gt;This query works from the web interface, but not from my python script.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2011 00:44:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32391#M5764</guid>
      <dc:creator>shahhe</dc:creator>
      <dc:date>2011-01-27T00:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the output baed on time and host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32392#M5765</link>
      <description>&lt;BLOCKQUOTE&gt;
  &lt;P&gt;I could not figure out how to markdown text in the comments, so I am posting my script as an answer.&lt;/P&gt;
  
  &lt;P&gt;Here is the python script &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import time
import string
import splunk 
import splunk.auth 
import splunk.search

searchQuery = r"search sourcetype=retrans daysago=1 WARNING | sort _time"
splunk.mergeHostPath('splunkserv:8089', True) 
key = splunk.auth.getSessionKey('user','passwd') 
job = splunk.search.dispatch(searchQuery) 

while not job.isDone: 
time.sleep(1) 

for x in job.events: 
   print x.fields 

job.cancel()
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 27 Jan 2011 02:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-sort-the-output-baed-on-time-and-host/m-p/32392#M5765</guid>
      <dc:creator>shahhe</dc:creator>
      <dc:date>2011-01-27T02:26:51Z</dc:date>
    </item>
  </channel>
</rss>

