<?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: How to convert date_* fields to epoch time after a join to calculate time difference? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149688#M30472</link>
    <description>&lt;P&gt;Thanks so lot! This is perfect!&lt;/P&gt;</description>
    <pubDate>Thu, 16 Apr 2015 19:27:45 GMT</pubDate>
    <dc:creator>singhbc</dc:creator>
    <dc:date>2015-04-16T19:27:45Z</dc:date>
    <item>
      <title>How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149682#M30466</link>
      <description>&lt;P&gt;I have a search that uses "join" which uses two sourcetypes to search the events and then joins them using a common field called ID. It works good to show me that for an ID, a service was called in sourcetype=A with timestamp in date_year (month, hour, minute and second) and ERROR was flagged in sourcetype=B with timestamp _time.&lt;/P&gt;

&lt;P&gt;What i need to do now is to subtract the &lt;CODE&gt;_time&lt;/CODE&gt; from the &lt;CODE&gt;date_hour&lt;/CODE&gt;, &lt;CODE&gt;date_minute&lt;/CODE&gt; and &lt;CODE&gt;date_second&lt;/CODE&gt; to get the difference. What is the best way to do that? Should I convert the &lt;CODE&gt;date_year&lt;/CODE&gt;, &lt;CODE&gt;date_month&lt;/CODE&gt; and so on to epoch time first? If yes how?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 17:45:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149682#M30466</guid>
      <dc:creator>singhbc</dc:creator>
      <dc:date>2015-04-16T17:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149683#M30467</link>
      <description>&lt;P&gt;Not sure about the requirement here. If you have &lt;CODE&gt;date_*&lt;/CODE&gt; fields in your sourcetype="A" then you should have a field _time as well, in epoch format. Whether subtraction of two _time (you would have rename the field to something else in order to have both time value from both the sourcetypes) values would not suffice?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:00:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149683#M30467</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-04-16T18:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149684#M30468</link>
      <description>&lt;P&gt;the &lt;CODE&gt;date_*&lt;/CODE&gt; fields are for the timestamp for when a "service" was called for an ID, and the &lt;EM&gt;time is for when the ERROR occurred for the same ID and they are about 10+ seconds apart, after the "join" is done, and after the "join" is done,  if i look at the events, it only shows the timestamp for the ERROR along with the event, whereas the `date&lt;/EM&gt;&lt;EM&gt;&lt;CODE&gt;shows only in the field list on the left side. and I have confirmed that the&lt;/CODE&gt;date_&lt;/EM&gt;` corresponds to the timestamp for the service in sourcetype="A" in a separate standalone search for that service. hope I am able to clarify.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149684#M30468</guid>
      <dc:creator>singhbc</dc:creator>
      <dc:date>2015-04-16T18:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149685#M30469</link>
      <description>&lt;P&gt;You can use strptime function with &lt;CODE&gt;eval/where&lt;/CODE&gt; to get the corresponding epoch time value from &lt;CODE&gt;date_*&lt;/CODE&gt; fields.&lt;/P&gt;

&lt;P&gt;try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search so far | eval timeA=strptime(date_year."-".date_month."-".date_mday." ".date_hour.":".date_minute.":".date_second,"%Y-%b-%d %H:%M:%S") | eval duration=_time-timeA
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149685#M30469</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-04-16T18:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149686#M30470</link>
      <description>&lt;P&gt;date_month is a string, how to convert it to integer value?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 19:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149686#M30470</guid>
      <dc:creator>singhbc</dc:creator>
      <dc:date>2015-04-16T19:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149687#M30471</link>
      <description>&lt;P&gt;just updated my search to handle string date_month (replace %m with %b)&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 19:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149687#M30471</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-04-16T19:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date_* fields to epoch time after a join to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149688#M30472</link>
      <description>&lt;P&gt;Thanks so lot! This is perfect!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 19:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-date-fields-to-epoch-time-after-a-join-to/m-p/149688#M30472</guid>
      <dc:creator>singhbc</dc:creator>
      <dc:date>2015-04-16T19:27:45Z</dc:date>
    </item>
  </channel>
</rss>

