<?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 how to find time difference in below format? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485394#M83085</link>
    <description>&lt;P&gt;New_Time=2020‎-‎01‎-‎19T15:06:53.134000000Z&lt;BR /&gt;
Previous_Time=2020‎-‎01‎-‎19T15:06:53.134396700Z&lt;/P&gt;

&lt;P&gt;how to find the time difference of above times?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:42:06 GMT</pubDate>
    <dc:creator>manuraj_rajappa</dc:creator>
    <dc:date>2020-09-30T03:42:06Z</dc:date>
    <item>
      <title>how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485394#M83085</link>
      <description>&lt;P&gt;New_Time=2020‎-‎01‎-‎19T15:06:53.134000000Z&lt;BR /&gt;
Previous_Time=2020‎-‎01‎-‎19T15:06:53.134396700Z&lt;/P&gt;

&lt;P&gt;how to find the time difference of above times?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485394#M83085</guid>
      <dc:creator>manuraj_rajappa</dc:creator>
      <dc:date>2020-09-30T03:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485395#M83086</link>
      <description>&lt;P&gt;Hi @&lt;A href="mailto:manuraj.rajappan@tcs.com"&gt;manuraj.rajappan@tcs.com&lt;/A&gt;,&lt;BR /&gt;
to find time differences, you have to convert your timestamps in epoch time using eval command and the strptime function, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search
| eval diff=strptime(New_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N")-strptime(Previous_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N")
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 15:23:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485395#M83086</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-20T15:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485396#M83087</link>
      <description>&lt;P&gt;To find the difference between times you must first convert them to epoch form.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval nt = strptime(New_Time, "%Y-%m-%dT%H:%M:%S.%9N%Z"), pt= strptime(Previous_Time, "%Y-%m-%dT%H:%M:%S.%9N%Z")
| eval diff = nt - pt
| fieldformat diff = tostring(diff, "duration")
| table diff
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 15:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485396#M83087</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-20T15:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485397#M83088</link>
      <description>&lt;P&gt;Please consider changing your user name.  We discourage the use of email addresses here to avoid spam.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 15:49:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485397#M83088</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-20T15:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485398#M83089</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8228iDB9D9DD276F21F4E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Am getting blank result while executing query. Please find the screenshot&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:04:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485398#M83089</guid>
      <dc:creator>manuraj_rajappa</dc:creator>
      <dc:date>2020-01-20T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485399#M83090</link>
      <description>&lt;P&gt;Am getting blank screen while executing query. (Please find above)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485399#M83090</guid>
      <dc:creator>manuraj_rajappa</dc:creator>
      <dc:date>2020-01-20T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485400#M83091</link>
      <description>&lt;P&gt;Hi @&lt;A href="mailto:manuraj.rajappan@tcs.com" target="_blank"&gt;manuraj.rajappan@tcs.com&lt;/A&gt;,&lt;BR /&gt;
I think that New_Time and Previous_Time are two field already extracted and present in you logs.&lt;BR /&gt;
If you haven't them, you have to understand how to extract them from logs or from a correlation.&lt;BR /&gt;
Can you share two events identifying the above fields?&lt;/P&gt;

&lt;P&gt;ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485400#M83091</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T03:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485401#M83092</link>
      <description>&lt;P&gt;Both filelds are available already for each event. No issues with this I guess. Need some help &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:23:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485401#M83092</guid>
      <dc:creator>manuraj_rajappa</dc:creator>
      <dc:date>2020-01-20T16:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485402#M83093</link>
      <description>&lt;P&gt;Getting blank result after query. Please advise.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485402#M83093</guid>
      <dc:creator>manuraj_rajappa</dc:creator>
      <dc:date>2020-01-20T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485403#M83094</link>
      <description>&lt;P&gt;Hi @&lt;A href="mailto:manuraj.rajappan@tcs.com"&gt;manuraj.rajappan@tcs.com&lt;/A&gt;,&lt;BR /&gt;
debug the situation in this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index New_Time=* Previous_Time=*
| table _time New_Time Previous_Time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in this way you can be sure that the fields are in each event&lt;/P&gt;

&lt;P&gt;than continue in this way&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index New_Time=* Previous_Time=*
| eval New_epoch_Time=strptime(New_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N"), Previous_epoch_Time=strptime(Previous_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N"), diff=strptime(New_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N")-strptime(Previous_Time,"%Y‎-%m‎-%dT%H:%M:%S.%9N")
| table _time New_Time Previous_Time New_epoch_Time Previous_epoch_Time diff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way you can see if the conversion in epoch time is correct.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485403#M83094</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-20T16:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to find time difference in below format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485404#M83095</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Check this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval New_Time="2020-01-19T15:06:53.134000000Z",Previous_Time="2020-01-19T15:06:53.134396700Z" 
| eval diff = strptime(Previous_Time, "%Y-%m-%dT%H:%M:%S.%9N%Z") -strptime(New_Time, "%Y-%m-%dT%H:%M:%S.%9N%Z") 
| fieldformat diff = tostring(diff, "duration") 
| table diff
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 04:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-find-time-difference-in-below-format/m-p/485404#M83095</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-01-21T04:44:25Z</dc:date>
    </item>
  </channel>
</rss>

