<?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 get only first  3 events as a result for each event/Field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175159#M50266</link>
    <description>&lt;P&gt;I think the streamstats command is what you may need to use to rank the events - take a look at &lt;A href="http://answers.splunk.com/answers/24011/rank-data-from-web-access-files.html"&gt;this answer&lt;/A&gt;, I believe it should point you in the right direction&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
    <pubDate>Tue, 28 Oct 2014 10:40:46 GMT</pubDate>
    <dc:creator>davebrooking</dc:creator>
    <dc:date>2014-10-28T10:40:46Z</dc:date>
    <item>
      <title>How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175156#M50263</link>
      <description>&lt;P&gt;I am attempting to get first 3 events  for each user field for which user  count&amp;gt;3. &lt;/P&gt;

&lt;P&gt;Basically what I am looking for is&lt;/P&gt;

&lt;P&gt;1)Get stats count for user field out of all data&lt;/P&gt;

&lt;P&gt;2)Identify events for which  user count&amp;gt;3&lt;/P&gt;

&lt;P&gt;3)Get only top 3 users out of all data for - user count&amp;gt;3&lt;/P&gt;

&lt;P&gt;4)and final result which  display only first 3 events for each user &lt;/P&gt;

&lt;P&gt;for below query I am getting user count and top 3 users with max count. &lt;/P&gt;

&lt;P&gt;index=windows  | stats count by user | sort - count | head 3 |where count&amp;gt;3&lt;/P&gt;

&lt;P&gt;result:&lt;/P&gt;

&lt;P&gt;User     count&lt;/P&gt;

&lt;P&gt;User1    8&lt;BR /&gt;
user2    4&lt;BR /&gt;
user3    6&lt;/P&gt;

&lt;P&gt;I want final result as  9 events----&amp;gt;containing first  3 events for each user.&lt;/P&gt;

&lt;P&gt;Could you please advice?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 02:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175156#M50263</guid>
      <dc:creator>thezero</dc:creator>
      <dc:date>2014-10-28T02:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175157#M50264</link>
      <description>&lt;P&gt;try this &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=windows | stats count by user  | where count&amp;gt;3 | top 3&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;otherwise try expanding your question a bit - its a little hard to follow...&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 02:31:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175157#M50264</guid>
      <dc:creator>0YAoNnmRmKDg</dc:creator>
      <dc:date>2014-10-28T02:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175158#M50265</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=windows | top limit=3 user | where count &amp;gt; 3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Oct 2014 02:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175158#M50265</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-10-28T02:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175159#M50266</link>
      <description>&lt;P&gt;I think the streamstats command is what you may need to use to rank the events - take a look at &lt;A href="http://answers.splunk.com/answers/24011/rank-data-from-web-access-files.html"&gt;this answer&lt;/A&gt;, I believe it should point you in the right direction&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 10:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175159#M50266</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2014-10-28T10:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175160#M50267</link>
      <description>&lt;P&gt;Does this get close to what you need? i just used 'eventtype' as an example.&lt;/P&gt;

&lt;P&gt;index=windows | stats count by user,eventtype | sort - user,eventtype | where count &amp;gt; 3 | top limit=3 eventtype by user&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 14:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175160#M50267</guid>
      <dc:creator>Jeff_Lightly_Sp</dc:creator>
      <dc:date>2014-10-28T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175161#M50268</link>
      <description>&lt;P&gt;Ah I see you've modified your question. Then perhaps:&lt;/P&gt;

&lt;P&gt;index=windows [ search index=windows | top limit=3 showperc=f user | where count &amp;gt; 3 ] | eventstats count by user | dedup 3 user sortby - count&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 14:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175161#M50268</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-10-28T14:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175162#M50269</link>
      <description>&lt;P&gt;H Gkanapathy,&lt;/P&gt;

&lt;P&gt;Thanks for the asnswer but its still showing only 3 results &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Rahul&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2014 08:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175162#M50269</guid>
      <dc:creator>thezero</dc:creator>
      <dc:date>2014-11-10T08:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only first  3 events as a result for each event/Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175163#M50270</link>
      <description>&lt;P&gt;try | head 3 after your search query&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2014 10:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-only-first-3-events-as-a-result-for-each-event-Field/m-p/175163#M50270</guid>
      <dc:creator>jitsinha</dc:creator>
      <dc:date>2014-11-10T10:36:48Z</dc:date>
    </item>
  </channel>
</rss>

