<?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: Finding most recent event by host in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299740#M164996</link>
    <description>&lt;P&gt;@anuremanan88, Try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| dedup host
| table *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk documentation of dedup command: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2017 10:31:23 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-21T10:31:23Z</dc:date>
    <item>
      <title>Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299739#M164995</link>
      <description>&lt;P&gt;We are collecting logs from McAfee and Splunk pulls information for each host every 1 Hr. The logs have two fields host and LastUpdateTime. I need to get the most recent event for each host using the LastUpdateTime without losing any other fields. Please help me in writing a query for this.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 09:20:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299739#M164995</guid>
      <dc:creator>anuremanan88</dc:creator>
      <dc:date>2017-11-21T09:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299740#M164996</link>
      <description>&lt;P&gt;@anuremanan88, Try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| dedup host
| table *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk documentation of dedup command: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 10:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299740#M164996</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-21T10:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299741#M164997</link>
      <description>&lt;P&gt;What format is LastUpdateTime in?&lt;BR /&gt;
Try something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|convert mktime(LastUpdateTime) as LastUpdateTimeEpoch timeformat="%Y-%m-%d %H:%M:%S"| stats max(LastUpdateTimeEpoch) as LastUpdateTimeEpoch by host |eval LastUpdateTime=strftime(LastUpdateTimeEpoch,"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Except change the time format to suit your needs. You can also use an &lt;CODE&gt;|eval LastUpdateTimeEpoch=strptime(LastUpdateTime,"%Y-%m-%d %H:%M:%S")&lt;/CODE&gt; instead of &lt;CODE&gt;convert&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 11:53:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299741#M164997</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-21T11:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299742#M164998</link>
      <description>&lt;P&gt;I need to get the most recent event using the field LastUpdateTime field for each host. dedup wont work here.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 11:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299742#M164998</guid>
      <dc:creator>anuremanan88</dc:creator>
      <dc:date>2017-11-21T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299743#M164999</link>
      <description>&lt;P&gt;Using stats will remove other fields present in the event. Is there a way to keep the other fields also&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 11:57:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299743#M164999</guid>
      <dc:creator>anuremanan88</dc:creator>
      <dc:date>2017-11-21T11:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299744#M165000</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH |eval LastUpdateTimeEpoch=strptime(LastUpdateTime,"%Y-%m-%d %H:%M:%S") | sort - LastUpdateTimeEpoch | dedup host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 12:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299744#M165000</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-21T12:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299745#M165001</link>
      <description>&lt;P&gt;you can do &lt;CODE&gt;...|stats values(*) as * max(LastUpdateTimeEpoch) as LastUpdateTimeEpoch by host |eval LastUpdateTime=strftime(LastUpdateTimeEpoch,"%Y-%m-%d %H:%M:%S")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 12:34:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299745#M165001</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-21T12:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299746#M165002</link>
      <description>&lt;P&gt;Can you add some sample data for your field?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 14:56:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299746#M165002</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-21T14:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299747#M165003</link>
      <description>&lt;P&gt;@kamlesh_vaghela - change that to &lt;CODE&gt;| sort - LastUpdateTimeEpoch |dedup host&lt;/CODE&gt; and you have it.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 16:01:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299747#M165003</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-21T16:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent event by host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299748#M165004</link>
      <description>&lt;P&gt;Hi @DalJeanis,&lt;/P&gt;

&lt;P&gt;Perfect!!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 16:08:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-most-recent-event-by-host/m-p/299748#M165004</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-21T16:08:09Z</dc:date>
    </item>
  </channel>
</rss>

