<?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: if multiple events at different time, only return most recent events based on a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480362#M192972</link>
    <description>&lt;P&gt;Just add this to the bottom:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | dedup IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 09 Nov 2019 23:16:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-11-09T23:16:51Z</dc:date>
    <item>
      <title>if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480360#M192970</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I've got a search that returns me the following results:&lt;/P&gt;

&lt;P&gt;Basically, I would like to only keep the most recent events for an IPAddress IF the field IPAddress has multiple events at 2 different time and discard the oldest event. In the case of the screenshot above, I would like to remove the highlighted line. &lt;/P&gt;

&lt;P&gt;Would that be possible? Let me know if you need more information.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2019 20:26:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480360#M192970</guid>
      <dc:creator>salt87</dc:creator>
      <dc:date>2019-11-09T20:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480361#M192971</link>
      <description>&lt;P&gt;Base on the example you provided&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(pluginID) as pluginID by _time, IPAddress delim=","
| slats latest(pluginID) as pluginID, max(_time) as _time by IPAddress
| eval pluginID=split(pluginID,",")
| mvexpand pluginID 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 21:24:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480361#M192971</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-09T21:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480362#M192972</link>
      <description>&lt;P&gt;Just add this to the bottom:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | dedup IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 23:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480362#M192972</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-09T23:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480363#M192973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;This won't work because I still need to see all events for an IPAddress. This will only show me one event per IP.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 20:50:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480363#M192973</guid>
      <dc:creator>salt87</dc:creator>
      <dc:date>2019-11-10T20:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480364#M192974</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Unfortunately this is not working as it only shows one event for IP3 and not 2 events as shown in the OP screenshot.&lt;/P&gt;

&lt;P&gt;This is the output:&lt;BR /&gt;
IPAddress                                    pluginID   _time&lt;BR /&gt;
IP1                                                     94932            2019-11-01 04:19:23&lt;BR /&gt;
IP2                                                   46172          2019-11-08 20:32:25&lt;BR /&gt;
IP3                                                   108797             2019-10-31 02:00:21&lt;/P&gt;

&lt;P&gt;What I would like is still keep both events for IP3 as per below:&lt;/P&gt;

&lt;P&gt;IPAddress                                    pluginID   _time&lt;BR /&gt;
IP1                                                     94932            2019-11-01 04:19:23&lt;BR /&gt;
IP2                                                   46172          2019-11-08 20:32:25&lt;BR /&gt;
IP3                                                   108797             2019-10-31 02:00:21&lt;BR /&gt;
IP3                                                   84729            2019-10-31 02:00:21&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 21:03:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480364#M192974</guid>
      <dc:creator>salt87</dc:creator>
      <dc:date>2019-11-10T21:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480365#M192975</link>
      <description>&lt;P&gt;Add this to the bottom of your existing search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats count BY _time IPAddress
| where count == 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Nov 2019 22:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480365#M192975</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-10T22:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480366#M192976</link>
      <description>&lt;P&gt;See my new answer.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 22:49:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480366#M192976</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-10T22:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: if multiple events at different time, only return most recent events based on a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480367#M192977</link>
      <description>&lt;P&gt;looks like latest is converting the mv field to a single value. Edited my answer. Please give it a try.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 22:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-multiple-events-at-different-time-only-return-most-recent/m-p/480367#M192977</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-10T22:49:30Z</dc:date>
    </item>
  </channel>
</rss>

