<?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 the difference between time stamps in 2 different events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-time-stamps-in-2-different/m-p/348036#M103063</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I am have a bunch of logs stating when a job has started and finished. I have been asked to find a way to tell how long the job took to run. I am having some trouble finding the best way to do this. Here the raw data of the logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CONS02^NO&amp;gt; 18:01:09.489 18:01:10   EDTMFD FIN  
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   FMMFD  FIN  
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   EDTMFD START
CONS02^NO&amp;gt; 18:00:04.514 18:00:04   FTPFIL FIN  
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPST  FIN  
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPFIL START
CONS02^NO&amp;gt; 18:00:03.558 18:00:03   FTPST  START
CONS02^NO&amp;gt; 18:00:03.363 18:00:03   FMMFD  START
CONS02^NO&amp;gt; 17:55:03.753 17:55:03   FTPFIL FIN  
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPSTA FIN  
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPFIL START
CONS02^NO&amp;gt; 17:55:02.986 17:55:02   FTPSTA START
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have been stumped on how to make this work. I was thinking the goal output would be to combine the 2 matching job events (1 Job START and 1 Job FIN) and have the difference between the time stamps as a new field, but I am not sure if this is even possible. &lt;/P&gt;

&lt;P&gt;Any ideas would be helpful!&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 20:11:10 GMT</pubDate>
    <dc:creator>MWAKburns</dc:creator>
    <dc:date>2017-06-15T20:11:10Z</dc:date>
    <item>
      <title>How to find the difference between time stamps in 2 different events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-time-stamps-in-2-different/m-p/348036#M103063</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I am have a bunch of logs stating when a job has started and finished. I have been asked to find a way to tell how long the job took to run. I am having some trouble finding the best way to do this. Here the raw data of the logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CONS02^NO&amp;gt; 18:01:09.489 18:01:10   EDTMFD FIN  
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   FMMFD  FIN  
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   EDTMFD START
CONS02^NO&amp;gt; 18:00:04.514 18:00:04   FTPFIL FIN  
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPST  FIN  
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPFIL START
CONS02^NO&amp;gt; 18:00:03.558 18:00:03   FTPST  START
CONS02^NO&amp;gt; 18:00:03.363 18:00:03   FMMFD  START
CONS02^NO&amp;gt; 17:55:03.753 17:55:03   FTPFIL FIN  
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPSTA FIN  
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPFIL START
CONS02^NO&amp;gt; 17:55:02.986 17:55:02   FTPSTA START
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have been stumped on how to make this work. I was thinking the goal output would be to combine the 2 matching job events (1 Job START and 1 Job FIN) and have the difference between the time stamps as a new field, but I am not sure if this is even possible. &lt;/P&gt;

&lt;P&gt;Any ideas would be helpful!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-time-stamps-in-2-different/m-p/348036#M103063</guid>
      <dc:creator>MWAKburns</dc:creator>
      <dc:date>2017-06-15T20:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between time stamps in 2 different events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-time-stamps-in-2-different/m-p/348037#M103064</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="CONS02^NO&amp;gt; 18:01:09.489 18:01:10   EDTMFD FIN
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   FMMFD  FIN
CONS02^NO&amp;gt; 18:01:09.089 18:01:10   EDTMFD START
CONS02^NO&amp;gt; 18:00:04.514 18:00:04   FTPFIL FIN
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPST  FIN
CONS02^NO&amp;gt; 18:00:03.758 18:00:03   FTPFIL START
CONS02^NO&amp;gt; 18:00:03.558 18:00:03   FTPST  START
CONS02^NO&amp;gt; 18:00:03.363 18:00:03   FMMFD  START
CONS02^NO&amp;gt; 17:55:03.753 17:55:03   FTPFIL FIN
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPSTA FIN
CONS02^NO&amp;gt; 17:55:03.186 17:55:03   FTPFIL START
CONS02^NO&amp;gt; 17:55:02.986 17:55:02   FTPSTA START"
| makemv delim="
" raw
| mvexpand raw
| rename raw AS _raw
| rex "^(?&amp;lt;host&amp;gt;\S+)\s+(?&amp;lt;_time&amp;gt;\S+)\s+(?&amp;lt;time2&amp;gt;\S+)\s+(?&amp;lt;job&amp;gt;\S+)\s+(?&amp;lt;msg&amp;gt;\S+)$"
| eval _time = strptime(_time, "%H:%M:%S.%3N")

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| stats range(_time) BY job
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-time-stamps-in-2-different/m-p/348037#M103064</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-15T20:45:56Z</dc:date>
    </item>
  </channel>
</rss>

