<?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 edit my search to select the newest event based on LastModTime field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304345#M91519</link>
    <description>&lt;P&gt;That worked perfect! Thank you!&lt;/P&gt;

&lt;P&gt;yourbase search | sort 0 ID -LastModTime | dedup ID&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2017 21:34:36 GMT</pubDate>
    <dc:creator>joesrepsol</dc:creator>
    <dc:date>2017-05-19T21:34:36Z</dc:date>
    <item>
      <title>How to edit my search to select the newest event based on LastModTime field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304343#M91517</link>
      <description>&lt;P&gt;So I'm taking in data from a source that has some duplicate records for the same ID. The only differentiator between events is a "LastModTime" field value, which is an integer. larger number means most recent change.&lt;/P&gt;

&lt;P&gt;So I'm trying to write a Splunk search to get all the events from this data source, and where multiple ID exists, only give me the most recent event (i.e. LastModTime is the largest value). Sounded so easy to say, but proving to be a challenge with mvindex command and now I'm stumped.&lt;/P&gt;

&lt;P&gt;ID      LastModTime Counter&lt;BR /&gt;
108         1495147243      1&lt;BR /&gt;
109         1495152331      1&lt;BR /&gt;
110         1495207972      1&lt;BR /&gt;
111         1495205705      1&lt;BR /&gt;
112         1495207542      1&lt;BR /&gt;
&lt;STRONG&gt;113       1495209093      1      I only want this event out of all the ID=113 events&lt;BR /&gt;
113         1495217660      1&lt;BR /&gt;
113         1495218310      1&lt;BR /&gt;
113         1495222596      1&lt;/STRONG&gt;&lt;BR /&gt;
114         1495211855      1&lt;BR /&gt;
115         1495212746      1 &lt;/P&gt;

&lt;P&gt;help?&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 21:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304343#M91517</guid>
      <dc:creator>joesrepsol</dc:creator>
      <dc:date>2017-05-19T21:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to select the newest event based on LastModTime field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304344#M91518</link>
      <description>&lt;P&gt;Assuming that your _time value is setup based on LastModTime field and you get one ID in one event/row, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | dedup ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It should keep only the latest record for every ID if it appears more that once.&lt;/P&gt;

&lt;P&gt;If your _time field is not based on LastModTime field, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourbase search | sort 0 ID -LastModTime | dedup ID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 May 2017 21:11:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304344#M91518</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-19T21:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to select the newest event based on LastModTime field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304345#M91519</link>
      <description>&lt;P&gt;That worked perfect! Thank you!&lt;/P&gt;

&lt;P&gt;yourbase search | sort 0 ID -LastModTime | dedup ID&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 21:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-select-the-newest-event-based-on/m-p/304345#M91519</guid>
      <dc:creator>joesrepsol</dc:creator>
      <dc:date>2017-05-19T21:34:36Z</dc:date>
    </item>
  </channel>
</rss>

