<?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 eval error &amp;quot;Typechecking failed, '-' only takes numbers.&amp;quot; How to convert Zulu time format to Epoch using strptime? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137866#M37812</link>
    <description>&lt;P&gt;A few of things:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;is "index_time" a field in your results? or are you referring to the Splunk index time, which is referred to as "_indextime"?&lt;/LI&gt;
&lt;LI&gt;If you ARE referring to _indextime, then it is unnecessary to try to convert it to Epoch time as it already comes in Epoch time.&lt;/LI&gt;
&lt;LI&gt;When using strptime you must conform to using this specific set of &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Commontimeformatvariables" target="_blank"&gt;time/date formats&lt;/A&gt; to define the format of the conversion.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Hope this helps &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:17:17 GMT</pubDate>
    <dc:creator>aholzer</dc:creator>
    <dc:date>2020-09-28T18:17:17Z</dc:date>
    <item>
      <title>Getting eval error "Typechecking failed, '-' only takes numbers." How to convert Zulu time format to Epoch using strptime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137865#M37811</link>
      <description>&lt;P&gt;(index=unix) (sourcetype="web") | eval Time.atFirewall=DateOutbound-DateInbound | eval Time.atDataCentre=strptime(index_time,"yyyy-MM-dd'T'HH:mm:ss.SSSZ") | eval Time.SendGrid=Time.atDataCentre-DateInbound | table index_time DateInbound DateOutbound Time.atFirewall Time.atDataCentre&lt;/P&gt;

&lt;P&gt;I get this in search:&lt;BR /&gt;
Error in 'eval' command: Typechecking failed. '-' only takes numbers.&lt;/P&gt;

&lt;P&gt;DateOutbound &amp;amp; DateInbound are Epoch Time fields, and I wanted to convert index time to Epoch to do the maths.  It seems that Time.atDataCentre is not assigned an Epoch time value, it's not a number, hence the Error message from Splunk.  I am following the documentation on strptime, so puzzled.&lt;/P&gt;

&lt;P&gt;Anyone ever convert long date / Zulu date to Epoch time?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137865#M37811</guid>
      <dc:creator>ITCrowd</dc:creator>
      <dc:date>2020-09-28T18:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting eval error "Typechecking failed, '-' only takes numbers." How to convert Zulu time format to Epoch using strptime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137866#M37812</link>
      <description>&lt;P&gt;A few of things:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;is "index_time" a field in your results? or are you referring to the Splunk index time, which is referred to as "_indextime"?&lt;/LI&gt;
&lt;LI&gt;If you ARE referring to _indextime, then it is unnecessary to try to convert it to Epoch time as it already comes in Epoch time.&lt;/LI&gt;
&lt;LI&gt;When using strptime you must conform to using this specific set of &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Commontimeformatvariables" target="_blank"&gt;time/date formats&lt;/A&gt; to define the format of the conversion.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Hope this helps &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:17:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137866#M37812</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2020-09-28T18:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting eval error "Typechecking failed, '-' only takes numbers." How to convert Zulu time format to Epoch using strptime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137867#M37813</link>
      <description>&lt;P&gt;Your strptime() format string is incorrect.  You probably want something like &lt;CODE&gt;strptime(index_time,"%Y-%m-%dT%H:%M:%S.%3NZ")&lt;/CODE&gt;.  See aholzer's comment for a link to the docs.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2014 16:31:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-eval-error-quot-Typechecking-failed-only-takes-numbers/m-p/137867#M37813</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-12-01T16:31:07Z</dc:date>
    </item>
  </channel>
</rss>

