<?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: creating a time delta field in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671166#M112513</link>
    <description>&lt;P&gt;My two cents - as I always say - leave the time related values as numbers until you need to finally render them to string for presentation. That way it's easier to manipulate them&amp;nbsp; (sort, offset and so on).&lt;/P&gt;&lt;P&gt;So I'd do just&lt;/P&gt;&lt;PRE&gt;_indextime - strptime(start_time, "%Y/%m/%d %H:%M:%S")&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Dec 2023 17:16:08 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-12-07T17:16:08Z</dc:date>
    <item>
      <title>creating a time delta field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/670967#M112483</link>
      <description>&lt;P&gt;The requirement is to create a time delta field which has the value of time difference between the 2 time fields. Basically the difference between start time &amp;amp; receive time should populate under new field name called timediff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have created eval conditions, can anyone help me with a props config based on that.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=XXX sourcetype IN(xx:xxx, xxx:xxxxx)
| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S")
| eval it = strptime(start_time, "%Y/%m/%d %H:%M:%S")
| eval ot = strptime(receive_time, "%Y/%m/%d %H:%M:%S")
| eval diff = tostring((ot - it), "duration")
| table start_time, receive_time,indextime,_time, diff&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 13:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/670967#M112483</guid>
      <dc:creator>NeharikaVats</dc:creator>
      <dc:date>2023-12-06T13:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: creating a time delta field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/670989#M112487</link>
      <description>&lt;P&gt;You should be able to create a calculated field called diff with the following value&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;tostring(strptime(receive_time, "%Y/%m/%d %H:%M:%S") - strptime(start_time, "%Y/%m/%d %H:%M:%S"), "duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 10:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/670989#M112487</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-12-06T10:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating a time delta field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671120#M112506</link>
      <description>&lt;P&gt;what if i want to get the difference between _indextime &amp;amp; start_time, i am trying with this :&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;tostring(strftime(_indextime, "%Y/%m/%d %H:%M:%S") - strptime(start_time, "%Y/%m/%d %H:%M:%S"), "duration")&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but getting error like-&amp;nbsp;&lt;SPAN class=""&gt;&lt;STRONG&gt;Encountered the following error while trying to save: Operator requires numeric types&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My search is:&lt;/P&gt;&lt;P&gt;index=xxx_xxx_firewall sourcetype IN(xxx:xxxxx, xxx:xxxxx)&lt;BR /&gt;| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval it = strptime(start_time, "%Y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval ot = strptime(receive_time, "%Y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval diff = tostring((ot - it), "duration")&lt;BR /&gt;| table start_time, receive_time,indextime,_time, diff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help if you have some insights on this.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 08:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671120#M112506</guid>
      <dc:creator>NeharikaVats</dc:creator>
      <dc:date>2023-12-07T08:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: creating a time delta field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671135#M112509</link>
      <description>&lt;P&gt;_indextime is already an epoch time - try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;tostring(_indextime - strptime(start_time, "%Y/%m/%d %H:%M:%S"), "duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 09:50:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671135#M112509</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-12-07T09:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating a time delta field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671166#M112513</link>
      <description>&lt;P&gt;My two cents - as I always say - leave the time related values as numbers until you need to finally render them to string for presentation. That way it's easier to manipulate them&amp;nbsp; (sort, offset and so on).&lt;/P&gt;&lt;P&gt;So I'd do just&lt;/P&gt;&lt;PRE&gt;_indextime - strptime(start_time, "%Y/%m/%d %H:%M:%S")&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/creating-a-time-delta-field/m-p/671166#M112513</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-12-07T17:16:08Z</dc:date>
    </item>
  </channel>
</rss>

