<?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: extract date from string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420360#M168519</link>
    <description>&lt;P&gt;Along with the answer from @mus, you need to make sure that you have a field &lt;CODE&gt;myTime&lt;/CODE&gt; first.  You create one like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?&amp;lt;myTime&amp;gt;(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+\S+\d+\s+\d+:\d+:\d+\s+\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Jul 2018 02:03:52 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-07-05T02:03:52Z</dc:date>
    <item>
      <title>extract date from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420358#M168517</link>
      <description>&lt;P&gt;Hello &lt;/P&gt;

&lt;P&gt;I have string from nessus . Wed Jun 6 02:02:10 2018 . &lt;/P&gt;

&lt;P&gt;I need to extract the date . strftime and strptime returns NULL. &lt;/P&gt;

&lt;P&gt;Any ideas for rex extraction ?&lt;/P&gt;

&lt;P&gt;I need to compare and sort the date for the last 45 days . &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 19:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420358#M168517</guid>
      <dc:creator>sravanthikand</dc:creator>
      <dc:date>2018-07-04T19:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: extract date from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420359#M168518</link>
      <description>&lt;P&gt;Hi sravanthikand,&lt;/P&gt;

&lt;P&gt;try this &lt;CODE&gt;strptime()&lt;/CODE&gt; format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval myTime="Wed Jun 6 02:02:10 2018" 
| eval epoch_time=strptime(myTime, "%c") 
| eval _time=epoch_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create a valid epoch timestamp.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5308i728F3DF01F5C0337/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 21:02:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420359#M168518</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-07-04T21:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: extract date from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420360#M168519</link>
      <description>&lt;P&gt;Along with the answer from @mus, you need to make sure that you have a field &lt;CODE&gt;myTime&lt;/CODE&gt; first.  You create one like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?&amp;lt;myTime&amp;gt;(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+\S+\d+\s+\d+:\d+:\d+\s+\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Jul 2018 02:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-date-from-string/m-p/420360#M168519</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-05T02:03:52Z</dc:date>
    </item>
  </channel>
</rss>

