<?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: Difficulty to get the time difference between two event time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247655#M189138</link>
    <description>&lt;P&gt;Getting below Error when i use | eval TimeDifference = tostring(3CMEndTime-3CMStartTime, "duration") |&lt;BR /&gt;
Not sure what i am missing in eval statement &lt;BR /&gt;
Error in 'eval' command: The expression is malformed. Expected ). &lt;/P&gt;

&lt;P&gt;Query is as below: &lt;/P&gt;

&lt;P&gt;search|eval 3CMStartTime = _time|table Corr 3CMStartTime|join Corr [search XXXXX|eval 3CMEndTime = _time]|table Corr 3CMStartTime 3CMEndTime|Join Corr [search XXX deliveryTime*]|fields Corr 3CMStartTime 3CMEndTime DeliveryDateTime|table Corr&lt;BR /&gt;
3CMStartTime 3CMEndTime DeliveryDateTime|eval TimeDifference = tostring(3CMEndTime-3CMStartTime, "duration"))&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2016 04:59:16 GMT</pubDate>
    <dc:creator>samarkumar</dc:creator>
    <dc:date>2016-08-26T04:59:16Z</dc:date>
    <item>
      <title>Difficulty to get the time difference between two event time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247653#M189136</link>
      <description>&lt;P&gt;I am using the below query &lt;BR /&gt;
search|eval 3CMStartTime = _time|table Corr 3CMStartTime|join Corr [search XXXXX|eval 3CMEndTime = _time]|table Corr 3CMStartTime 3CMEndTime|Join Corr [search XXX deliveryTime*]|fields Corr 3CMStartTime 3CMEndTime DeliveryDateTime|table Corr &lt;BR /&gt;
3CMStartTime 3CMEndTime DeliveryDateTime|&lt;/P&gt;

&lt;P&gt;Data is coming as follow: &lt;BR /&gt;
Corr 3CMStartTime   3CMEndTime  DeliveryDateTime&lt;BR /&gt;
XX1 1472157011  1472157012  2016-08-25T13:30:36.823&lt;BR /&gt;
XX2 1472156537  1472156541  2016-08-25T13:23:38.59&lt;BR /&gt;
XX3     1472156494  1472156494  2016-08-25T13:23:32.39 &lt;/P&gt;

&lt;P&gt;I need time difference in seconds for below: &lt;/P&gt;

&lt;P&gt;Eval diffr1=3CMEndTime - 3CMStartTime   &lt;/P&gt;

&lt;P&gt;eval diffr2=DeliveryDateTime-3CMEndTime     &lt;/P&gt;

&lt;P&gt;i was trying &lt;/P&gt;

&lt;P&gt;eval TimeDifference = strftime((EpochTime(3CMEndTime) - EpochTime(3CMStartTime )) , "%H:%M:%S")&lt;/P&gt;

&lt;P&gt;but getting below error "Error in 'eval' command: The expression is malformed. Expected ). "&lt;/P&gt;

&lt;P&gt;Your help will be greatly appreciated. &lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 04:26:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247653#M189136</guid>
      <dc:creator>samarkumar</dc:creator>
      <dc:date>2016-08-26T04:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty to get the time difference between two event time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247654#M189137</link>
      <description>&lt;P&gt;Your time already appears to be in epoch format, so there is no need to convert it. Also, time difference is in seconds, so strftime is not the right function to format it. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eval TimeDifference = tostring(3CMEndTime-3CMStartTime, "duration") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 04:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247654#M189137</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-26T04:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty to get the time difference between two event time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247655#M189138</link>
      <description>&lt;P&gt;Getting below Error when i use | eval TimeDifference = tostring(3CMEndTime-3CMStartTime, "duration") |&lt;BR /&gt;
Not sure what i am missing in eval statement &lt;BR /&gt;
Error in 'eval' command: The expression is malformed. Expected ). &lt;/P&gt;

&lt;P&gt;Query is as below: &lt;/P&gt;

&lt;P&gt;search|eval 3CMStartTime = _time|table Corr 3CMStartTime|join Corr [search XXXXX|eval 3CMEndTime = _time]|table Corr 3CMStartTime 3CMEndTime|Join Corr [search XXX deliveryTime*]|fields Corr 3CMStartTime 3CMEndTime DeliveryDateTime|table Corr&lt;BR /&gt;
3CMStartTime 3CMEndTime DeliveryDateTime|eval TimeDifference = tostring(3CMEndTime-3CMStartTime, "duration"))&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 04:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247655#M189138</guid>
      <dc:creator>samarkumar</dc:creator>
      <dc:date>2016-08-26T04:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty to get the time difference between two event time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247656#M189139</link>
      <description>&lt;P&gt;Try putting your field names within single quotes. Eval statement does not like it when field names start with a number or has special characters in it. So you eval should look like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval TimeDifference = tostring('3CMEndTime'-'3CMStartTime', "duration"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 14:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247656#M189139</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-26T14:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty to get the time difference between two event time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247657#M189140</link>
      <description>&lt;P&gt;I discussed with Sundareshr, and found that the below one is working as expected. &lt;BR /&gt;
..| eval TimeDifference = tostring('3CMEndTime'-'3CMStartTime', "duration") | &lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 14:43:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difficulty-to-get-the-time-difference-between-two-event-time/m-p/247657#M189140</guid>
      <dc:creator>samarkumar</dc:creator>
      <dc:date>2016-08-26T14:43:59Z</dc:date>
    </item>
  </channel>
</rss>

