<?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: get bottom 3 duration within each group in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578382#M201567</link>
    <description>&lt;P&gt;You say 3 but show 4 or 5 values. Since those results are (at least in your example) indistinguishable, there's no point in showing them separately.&lt;/P&gt;&lt;P&gt;So it's either&lt;/P&gt;&lt;PRE&gt;&amp;lt;your search&amp;gt;&lt;BR /&gt;| sort website Duration&lt;BR /&gt;| streamstats count by website&lt;BR /&gt;| where count&amp;lt;=3&lt;/PRE&gt;&lt;P&gt;Or you could try&lt;/P&gt;&lt;PRE&gt;&amp;lt;your search&amp;gt;&lt;BR /&gt;| eventstats count by website Duration&lt;BR /&gt;| sort website Duration&lt;BR /&gt;| streamstats count as webcount by website&lt;BR /&gt;| where webcount&amp;lt;=3&lt;/PRE&gt;&lt;P&gt;If you really want to have all values for the three distinct lowest values of Duration, that can probably be achieved but would be way uglier to perform.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 21:36:47 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-12-14T21:36:47Z</dc:date>
    <item>
      <title>get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578376#M201564</link>
      <description>&lt;P&gt;I have duration for multiple websites.&lt;/P&gt;&lt;P&gt;How can I get 3 least duration for each websites.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So here is example&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Duration_in_min&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;website&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;ExtraColumn&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;10.0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;x.com&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;2.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;2.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;AA&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;3.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;4.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;ABC&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;15.0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;Y.com&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;BB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;1.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;CAV&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;1.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;XY&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;3.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;4.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;5.0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;Y.com&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;BB&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;So I only want these rows ( 3 least duration for each website).&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Duration_in_min&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;website&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;ExtraColumn&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;2.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;2.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;AA&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;3.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;4.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;x.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;ABC&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;1.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;CAV&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;1.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;XY&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;3.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&lt;STRONG&gt;4.0&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;&amp;nbsp;Y.com&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 01:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578376#M201564</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T01:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578382#M201567</link>
      <description>&lt;P&gt;You say 3 but show 4 or 5 values. Since those results are (at least in your example) indistinguishable, there's no point in showing them separately.&lt;/P&gt;&lt;P&gt;So it's either&lt;/P&gt;&lt;PRE&gt;&amp;lt;your search&amp;gt;&lt;BR /&gt;| sort website Duration&lt;BR /&gt;| streamstats count by website&lt;BR /&gt;| where count&amp;lt;=3&lt;/PRE&gt;&lt;P&gt;Or you could try&lt;/P&gt;&lt;PRE&gt;&amp;lt;your search&amp;gt;&lt;BR /&gt;| eventstats count by website Duration&lt;BR /&gt;| sort website Duration&lt;BR /&gt;| streamstats count as webcount by website&lt;BR /&gt;| where webcount&amp;lt;=3&lt;/PRE&gt;&lt;P&gt;If you really want to have all values for the three distinct lowest values of Duration, that can probably be achieved but would be way uglier to perform.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578382#M201567</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-12-14T21:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578383#M201568</link>
      <description>&lt;P&gt;So I need to show those 4 or 5 values too because they are same. I am looking to view &lt;STRONG&gt;table where duration falls into bottom 3 for each website&lt;/STRONG&gt;.&amp;nbsp; I made my example simple, but there will more columns. And I want to see all the fields. I updated my question to reflect this. Hopefully I am making sense here. But I already knew about StreamStats. And this is the reason I coudn't use it.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578383#M201568</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-14T21:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578394#M201571</link>
      <description>&lt;P&gt;This relies lexicographic sorting provided by values - if you need numeric sorting, you will need to convert your duration field to a number.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Duration	website	ExtraColumn
1 min	x.com	A
2 min	x.com	B
2 min	x.com	AA
3 min	x.com	C
4 min	x.com	ABC
1 min	Y.com	BB
1 min	Y.com	CAV
1 min	Y.com	XY
3 min	Y.com	A
4 min	Y.com	B
5 min	Y.com	BB"
| multikv forceheader=1
| table Duration website ExtraColumn



| eventstats values(Duration) as Durations by website
| eval Durations=mvdedup(Durations)
| eval Durations=mvindex(Durations,0,2)
| eval keep=mvfind(Durations,Duration)
| where isnotnull(keep)
| table Duration website ExtraColumn&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 14 Dec 2021 23:14:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578394#M201571</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-14T23:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578408#M201580</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, I do&amp;nbsp;&lt;SPAN&gt;need numeric sorting and I update my question too.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works ( I had to add&amp;nbsp;&lt;STRONG&gt;| sort website Duration ExtraColumn &lt;/STRONG&gt;before we use eventstats)&amp;nbsp; if I use your example data, but its not working if I update your example with this data&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Duration website ExtraColumn&lt;BR /&gt;4 x.com ABC&lt;BR /&gt;5 x.com AB&lt;BR /&gt;6 x.com AC&lt;BR /&gt;2 x.com AA&lt;BR /&gt;5 y.com AB&lt;BR /&gt;6 y.com AC&lt;BR /&gt;2 y.com AA&lt;BR /&gt;7 x.com AC&lt;BR /&gt;10 x.com AA&lt;BR /&gt;10 x.com AAA&lt;BR /&gt;10 y.com AB&lt;BR /&gt;2 y.com ABC&lt;BR /&gt;3 y.com AC&lt;BR /&gt;3 x.com C&lt;/P&gt;&lt;P&gt;For some reason &lt;STRONG&gt;Values&lt;/STRONG&gt;&amp;nbsp;is sorting duration as if its string. Not sure why its doing that. I guess this is the reason its not working.&amp;nbsp; My duration is already a number because when I do normal sorting , it sorts corrects.&amp;nbsp;&lt;STRONG&gt;| sort 0 website duration &lt;/STRONG&gt;sort&amp;nbsp;works fine here. Also I know my duration field is number because I am doing number based filter (duration &amp;gt;=0) before I use your logic.&lt;/P&gt;&lt;P&gt;Also I noticed that this logic takes lot of time which I guess is because of Values command. If there are 1000s record per website then this is going to be very slow ?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update: I changed Values to list and now its working.&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;can you please advice if this is the right way or this might create other problems. But I do see that list has limitation to only display 100 values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 02:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578408#M201580</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T02:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578411#M201581</link>
      <description>&lt;P&gt;Since you're looking for the bottom 3, we can try deduping and keeping 10 lowest duration record for each site which makes it easier downstream -- you can adjust that number up or down depending on your data.&lt;/P&gt;&lt;P&gt;Bit of a hack, here's my attempt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Duration_in_min	website	ExtraColumn
10	x.com	A
2	x.com	B
2	x.com	AA
3	x.com	C
4	x.com	ABC
15	Y.com	BB
1	Y.com	CAV
1	Y.com	XY
3	Y.com	A
4	Y.com	B
5	Y.com	BB"
| multikv forceheader=1
| eval Duration_in_min=ROUND(Duration_in_min, 1)
| table Duration_in_min website ExtraColumn

| sort 0 Duration_in_min website
| dedup 10 website
| eval Duration_in_min=ROUND(Duration_in_min, 1)
| eventstats list(Duration_in_min) AS duration_list by website
| eval duration_list=MVDEDUP(duration_list)
| eval duration_3rd=IF(MVCOUNT(duration_list)&amp;gt;3, MVINDEX(duration_list, 2), MVINDEX(duration_list, -1))
| where Duration_in_min&amp;lt;=duration_3rd
| sort 0 -website Duration_in_min
| table Duration_in_min website ExtraColumn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 03:57:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578411#M201581</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2021-12-15T03:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578416#M201582</link>
      <description>&lt;P&gt;Good idea, the only problem is that there is no guarantee how many duplicate durations will be there. So if I dedup 25 and there are 100 duplicate durations that are within bottom 3 then I will lose most of them.&lt;/P&gt;&lt;P&gt;Wish I can rank each row by site and duration and then I can easily filter by rank. I would expect Splunk should provide this out of box functionality.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 04:25:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578416#M201582</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T04:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578417#M201583</link>
      <description>&lt;P&gt;Yep.&lt;BR /&gt;&lt;BR /&gt;How many websites are in this data set?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 04:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578417#M201583</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2021-12-15T04:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578418#M201584</link>
      <description>&lt;P&gt;In my case there can be around 100 sites. And each site can have 1000s of durations.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 04:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578418#M201584</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T04:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578452#M201600</link>
      <description>&lt;P&gt;So this is getting a completely different task altogether and you should have specified that from the start.&lt;/P&gt;&lt;P&gt;Yes, you can use streamstats (and that's probably the only reasonable approach).&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE&gt;&amp;lt;your search&amp;gt;&lt;BR /&gt;| sort 0 website Duration&lt;/PRE&gt;&lt;P&gt;Here you have your results ranked by website and within each website by Duration. We're gonna need this in this form (and you want it returned like this anyway :-)).&lt;/P&gt;&lt;P&gt;So now we'll check if the Duration value changed vs. previous occurrence.&lt;/P&gt;&lt;PRE&gt;| streamstats window=2 current=t dc(Duration) as duration_changes by client&lt;BR /&gt;| eval duration_changes=duration_changes-1&lt;/PRE&gt;&lt;P&gt;Now we can count how many times for any particular website the Duration value changed.&lt;/P&gt;&lt;PRE&gt;| streamstats sum(duration_changes) as rank by website&lt;/PRE&gt;&lt;P&gt;And now, since we know that our data was already sorted, which means that any Duration change must have been increasing the value we can filter the results to include only those that changed Duration at most two times, since you want to get top 3 results.&lt;/P&gt;&lt;PRE&gt;| where rank&amp;lt;3&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 12:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578452#M201600</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-12-15T12:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578466#M201606</link>
      <description>&lt;P&gt;I tested with following data and it dosen't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval _raw="Duration_in_min website ExtraColumn&lt;BR /&gt;10 x.com A&lt;BR /&gt;15 x.com A&lt;BR /&gt;2 x.com B&lt;BR /&gt;2 x.com AA&lt;BR /&gt;3 x.com C&lt;BR /&gt;4 x.com ABC&lt;BR /&gt;15 Y.com BB&lt;BR /&gt;10 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAVH&lt;BR /&gt;1 Y.com XYF&lt;BR /&gt;1 Y.com CAVF&lt;BR /&gt;1 Y.com XYF&lt;BR /&gt;1 Y.com CAVD&lt;BR /&gt;1 Y.com XYD&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com CXY&lt;BR /&gt;1 Y.com CCAV&lt;BR /&gt;1 Y.com XCY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;1 Y.com CAV&lt;BR /&gt;1 Y.com XY&lt;BR /&gt;3 Y.com A&lt;BR /&gt;4 Y.com B&lt;BR /&gt;5 Y.com BB"&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:28:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578466#M201606</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T13:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578475#M201611</link>
      <description>&lt;P&gt;You could create a zero filled version of the duration and use that although this may not solve the multi-value limit problem&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;solution with streamstats is probably a better approach overall&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Duration_in_min,website,ExtraColumn
10,x.com,A
15,x.com,A
2,x.com,B
2,x.com,AA
3,x.com,C
4,x.com,ABC
15,Y.com,BB
10,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAVH
1,Y.com,XYF
1,Y.com,CAVF
1,Y.com,XYF
1,Y.com,CAVD
1,Y.com,XYD
1,Y.com,CAV
1,Y.com,CAV
1,Y.com,CXY
1,Y.com,CCAV
1,Y.com,XCY
1,Y.com,CAV
1,Y.com,XY
1,Y.com,CAV
1,Y.com,XY
3,Y.com,A
4,Y.com,B
5,Y.com,BB"
| multikv forceheader=1
| table Duration_in_min website ExtraColumn
| eval Duration=printf("%04d",Duration_in_min)
| eventstats values(Duration) as Durations by website
| eval Durations=mvdedup(Durations)
| eval Durations=mvindex(Durations,0,2)
| eval keep=mvfind(Durations,Duration)
| where isnotnull(keep)
| table Duration_in_min website ExtraColumn&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578475#M201611</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-15T13:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578488#M201620</link>
      <description>&lt;P&gt;It works. I told you to adjust the dedup according to&amp;nbsp;cardinality of your data. In this case, change the dedup to 100.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Duration_in_min	website	ExtraColumn
10	x.com	A
15	x.com	A
2	x.com	B
2	x.com	AA
3	x.com	C
4	x.com	ABC
15	Y.com	BB
10	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAVH
1	Y.com	XYF
1	Y.com	CAVF
1	Y.com	XYF
1	Y.com	CAVD
1	Y.com	XYD
1	Y.com	CAV
1	Y.com	CAV
1	Y.com	CXY
1	Y.com	CCAV
1	Y.com	XCY
1	Y.com	CAV
1	Y.com	XY
1	Y.com	CAV
1	Y.com	XY
3	Y.com	A
4	Y.com	B
5	Y.com	BB"
| multikv forceheader=1
| table Duration_in_min website ExtraColumn

| sort 0 Duration_in_min website
| dedup 100 website
| eval Duration_in_min=ROUND(Duration_in_min, 1)
| eventstats list(Duration_in_min) AS duration_list by website
| eval duration_list=MVDEDUP(duration_list)
| eval duration_3rd=IF(MVCOUNT(duration_list)&amp;gt;3, MVINDEX(duration_list, 2), MVINDEX(duration_list, -1))
| where Duration_in_min&amp;lt;=duration_3rd
| sort 0 -website Duration_in_min
| table Duration_in_min website ExtraColumn&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Dec 2021 14:47:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578488#M201620</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2021-12-15T14:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578495#M201625</link>
      <description>&lt;P&gt;sorry&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;I didn't tried that. But why are we sorting by duration and then by website? should this be other way around because i want this by site and then by duration. Sorry I am not understand the logic here. Can you please explain? Also is there any condition where this will fail (other than more than 100 sites if I dedup 100) ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 15:38:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578495#M201625</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T15:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: get bottom 3 duration within each group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578505#M201630</link>
      <description>&lt;P&gt;WoW.. this looks like is the solution . Thank you&amp;nbsp;@Anonymous&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;all for your solutions. All helped me learn something new today &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 16:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-bottom-3-duration-within-each-group/m-p/578505#M201630</guid>
      <dc:creator>arusoft</dc:creator>
      <dc:date>2021-12-15T16:11:18Z</dc:date>
    </item>
  </channel>
</rss>

