<?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: Date type issue on extracted fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501617#M195119</link>
    <description>&lt;P&gt;Great @clementros.  Please upvote and accept this answer to close this question.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 11:13:31 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2019-12-05T11:13:31Z</dc:date>
    <item>
      <title>Date type issue on extracted fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501614#M195116</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I have two date fields extracted &lt;EM&gt;(with regex)&lt;/EM&gt; from log files. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;starting_collection_timestamp = Thu Oct 17 22:40:10 GMT 2019
end_collection_timestamp = Thu Oct 17 22:40:21 GMT 2019 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried to know the exact type for this fields with the command : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval t=typeof(starting_collection_timestamp)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the result : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        _time              |            t
 2019-11-29 08:56:43                 Invalid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When i tried to calculate the elapsed time between &lt;STRONG&gt;&lt;EM&gt;starting_collection_timestamp&lt;/EM&gt;&lt;/STRONG&gt; and &lt;STRONG&gt;&lt;EM&gt;end_collection_timestamp&lt;/EM&gt;&lt;/STRONG&gt; i have an empty field.&lt;/P&gt;

&lt;P&gt;I tried to change the type with the command &lt;STRONG&gt;&lt;EM&gt;strptime&lt;/EM&gt;&lt;/STRONG&gt; without sucess. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval strptime('starting_collection_timestamp', "%a %b %d %H:%M:%S %Z %Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501614#M195116</guid>
      <dc:creator>clementros</dc:creator>
      <dc:date>2020-09-30T03:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date type issue on extracted fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501615#M195117</link>
      <description>&lt;P&gt;@clementros &lt;/P&gt;

&lt;P&gt;I think you should try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval starting_collection_timestamp="Thu Oct 17 22:40:10 GMT 2019", end_collection_timestamp="Thu Oct 17 22:40:21 GMT 2019" 
| eval starting_collection_timestamp = strptime('starting_collection_timestamp', "%a %b %d %H:%M:%S %Z %Y") 
| eval end_collection_timestamp = strptime('end_collection_timestamp', "%a %b %d %H:%M:%S %Z %Y") 
| eval total_duration = end_collection_timestamp - starting_collection_timestamp 
| eval duration = tostring(total_duration, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Dec 2019 09:27:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501615#M195117</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T09:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date type issue on extracted fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501616#M195118</link>
      <description>&lt;P&gt;Thank you it works&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 11:02:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501616#M195118</guid>
      <dc:creator>clementros</dc:creator>
      <dc:date>2019-12-05T11:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date type issue on extracted fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501617#M195119</link>
      <description>&lt;P&gt;Great @clementros.  Please upvote and accept this answer to close this question.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 11:13:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-type-issue-on-extracted-fields/m-p/501617#M195119</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T11:13:31Z</dc:date>
    </item>
  </channel>
</rss>

