<?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 can I get query only the last ten files from each device regardless of time range? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351869#M175173</link>
    <description>&lt;P&gt;Thank you kat54! That works great. I was using a field that goes up by one for each subsequent sample run or "file":  source|stats first("Service Counter") as frst last("Service Counter") as lst by "instr_id" |eval Range=(frst - lst) |where Range&amp;lt;10&lt;/P&gt;

&lt;P&gt;The problem is that I want to have all ten most recent files for each device, then perform stats on the results (essentially filter the results and find the median, mean, or certain fields, as well the count of fields out of those ten files that meet the filtering requirements. I tried doing a join to the solution you gave me and the one I had come up with (yours is much more elegant and I have found a workaround using it). I am really new to Splunk and need some more time to test one more idea, but for now, I can export the solution you provided with the fields I need to perform stats on to Excel or SAS and do the refining there. Make sense? I'm not sure how much detail to go into. &lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2017 02:15:51 GMT</pubDate>
    <dc:creator>peterh26</dc:creator>
    <dc:date>2017-03-13T02:15:51Z</dc:date>
    <item>
      <title>How can I get query only the last ten files from each device regardless of time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351867#M175171</link>
      <description>&lt;P&gt;I am looking at 10,000 devices and want to look at the last ten files each one has produced. Some will create 100 files a day, some 10 files per week, so I cannot use date, I need to be able to get a count out of the last ten files that violate specific criteria.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 08:45:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351867#M175171</guid>
      <dc:creator>peterh26</dc:creator>
      <dc:date>2017-03-12T08:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get query only the last ten files from each device regardless of time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351868#M175172</link>
      <description>&lt;P&gt;index=yourIndexName [index=yourIndexName | dedup host | fields host | return host] | dedup 10 source&lt;/P&gt;

&lt;P&gt;Unfortunately there is a limitation of 10,000 on subsearches I believe.  Besides this next one might be exactly what you need.&lt;/P&gt;

&lt;P&gt;index=yourIndexName | dedup 10 host source | table host source | sort 0 host&lt;/P&gt;

&lt;P&gt;Events returned by dedup are based on search order. For historical searches, the most recent events are searched first. For real-time searches, the first events that are received are search, which are not necessarily the most recent events.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 17:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351868#M175172</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-12T17:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get query only the last ten files from each device regardless of time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351869#M175173</link>
      <description>&lt;P&gt;Thank you kat54! That works great. I was using a field that goes up by one for each subsequent sample run or "file":  source|stats first("Service Counter") as frst last("Service Counter") as lst by "instr_id" |eval Range=(frst - lst) |where Range&amp;lt;10&lt;/P&gt;

&lt;P&gt;The problem is that I want to have all ten most recent files for each device, then perform stats on the results (essentially filter the results and find the median, mean, or certain fields, as well the count of fields out of those ten files that meet the filtering requirements. I tried doing a join to the solution you gave me and the one I had come up with (yours is much more elegant and I have found a workaround using it). I am really new to Splunk and need some more time to test one more idea, but for now, I can export the solution you provided with the fields I need to perform stats on to Excel or SAS and do the refining there. Make sense? I'm not sure how much detail to go into. &lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 02:15:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351869#M175173</guid>
      <dc:creator>peterh26</dc:creator>
      <dc:date>2017-03-13T02:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get query only the last ten files from each device regardless of time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351870#M175174</link>
      <description>&lt;P&gt;The dedup 10 will give the latest 10 results assuming timestamps are correctly ordered.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 19:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351870#M175174</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-13T19:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get query only the last ten files from each device regardless of time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351871#M175175</link>
      <description>&lt;P&gt;thanks again, this has been an incredibly helpful tool in my analysis, much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 04:58:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-query-only-the-last-ten-files-from-each-device/m-p/351871#M175175</guid>
      <dc:creator>peterh26</dc:creator>
      <dc:date>2017-03-20T04:58:05Z</dc:date>
    </item>
  </channel>
</rss>

