<?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: Group by id. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481351#M134891</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MyIndex 
| stats max(_time) AS _time values(status) AS status BY id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or perhaps this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MyIndex 
| stats max(_time) AS _time BY status id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 09 Nov 2019 22:48:47 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-11-09T22:48:47Z</dc:date>
    <item>
      <title>Group by id.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481349#M134889</link>
      <description>&lt;P&gt;I have a query like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=MyIndex 
    | stats values(status) as status by id, time
    | dedup id,status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives me something like this &lt;BR /&gt;
Status              id         time&lt;BR /&gt;
apply              123      2019-10-28 10:04:02.707 EST&lt;BR /&gt;
verify              123      2019-10-28 10:04:07.767 EST&lt;BR /&gt;
approved       123      2019-10-28 10:04:10.707 PDT&lt;BR /&gt;
login                123     2019-10-28 10:04:12.707 PDT&lt;BR /&gt;
but I want&lt;BR /&gt;
id            latest(time)                                             Status&lt;BR /&gt;
123.       2019-10-28 10:04:12.707 PDT             apply, verify, approved login&lt;/P&gt;

&lt;P&gt;I did try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats values(status), latest(time) by id but, the problem is with values(status) they're getting sorted alphabetically.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for your time.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2019 03:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481349#M134889</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-11-09T03:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Group by id.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481350#M134890</link>
      <description>&lt;P&gt;Using&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats list(status) as status latest(time) by id
| eval status=mvjoin(mvdedup(status),",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;list does not sort the items, but it also reports all occurrences of status, so if there is more than one of a single status, it will list all, hence the mvdedup will dedup the duplicates without changing the order.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2019 06:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481350#M134890</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2019-11-09T06:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Group by id.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481351#M134891</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MyIndex 
| stats max(_time) AS _time values(status) AS status BY id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or perhaps this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MyIndex 
| stats max(_time) AS _time BY status id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 22:48:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481351#M134891</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-09T22:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Group by id.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481352#M134892</link>
      <description>&lt;P&gt;This is beautiful, Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 17:48:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-by-id/m-p/481352#M134892</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-11-11T17:48:06Z</dc:date>
    </item>
  </channel>
</rss>

