<?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: Getting Time of last occurrence of a sbstring in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356914#M174603</link>
    <description>&lt;P&gt;maybe, try - tail 1 --- to get the oldest event and then a rex to extract the timestamp. &lt;/P&gt;

&lt;P&gt;( "tail 1" worked the opposite way around, replace it with "head 1" ) &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="**"  Message="Finished Cleanup" | tail 1 | rex field=_raw "^(?&amp;lt;DateTime&amp;gt;\d+\/\d+\/\d+\s+\d+:\d+:\d+)" | table DateTime _raw&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2017 09:02:01 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2017-06-19T09:02:01Z</dc:date>
    <item>
      <title>Getting Time of last occurrence of a sbstring</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356912#M174601</link>
      <description>&lt;P&gt;I have events like below in a log file-&lt;/P&gt;

&lt;P&gt;06/18/2017 22:35:10,Message="Finished Cleanup"&lt;BR /&gt;
06/18/2017 22:57:02,Message="Finished Cleanup"&lt;BR /&gt;
06/18/2017 22:57:02,Message="Finished Cleanup"&lt;/P&gt;

&lt;P&gt;I want to extract (only) the time "06/18/2017 22:57" i.e. the time of last occurrence.&lt;/P&gt;

&lt;P&gt;I used-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="**"  Message="Finished Cleanup" |  stats max(_time) as time by Message  | eval End_Time=strftime(time,"%m/%d/%Y %H:%M")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But stats is not helping as I only want the time stamp.&lt;BR /&gt;
How can I get time stamp only.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 04:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356912#M174601</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2017-06-19T04:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Time of last occurrence of a sbstring</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356913#M174602</link>
      <description>&lt;P&gt;You are filtering out based on the Message field, so you don't need to use it with stats command -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="**"  Message="Finished Cleanup" |  stats max(_time) as time | eval End_Time=strftime(time,"%m/%d/%Y %T")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also you are filter fields using the &lt;CODE&gt;fields&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Fields"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Fields&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 05:34:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356913#M174602</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-19T05:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Time of last occurrence of a sbstring</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356914#M174603</link>
      <description>&lt;P&gt;maybe, try - tail 1 --- to get the oldest event and then a rex to extract the timestamp. &lt;/P&gt;

&lt;P&gt;( "tail 1" worked the opposite way around, replace it with "head 1" ) &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="**"  Message="Finished Cleanup" | tail 1 | rex field=_raw "^(?&amp;lt;DateTime&amp;gt;\d+\/\d+\/\d+\s+\d+:\d+:\d+)" | table DateTime _raw&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 09:02:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356914#M174603</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2017-06-19T09:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Time of last occurrence of a sbstring</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356915#M174604</link>
      <description>&lt;P&gt;Hi siddharthmis, may we know if this is working fine now? can you please mark this as completed&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 00:02:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Time-of-last-occurrence-of-a-sbstring/m-p/356915#M174604</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2017-06-21T00:02:55Z</dc:date>
    </item>
  </channel>
</rss>

