<?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 Eval total duration in minutes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462988#M191480</link>
    <description>&lt;P&gt;i've created a table from a project run that displays the time a run started, ended and what time files have been created during the run.&lt;/P&gt;

&lt;P&gt;However Im trying to do an eval to get the Total Duration in Minutes for each service which is&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 06:15:45 GMT</pubDate>
    <dc:creator>lavster</dc:creator>
    <dc:date>2019-08-28T06:15:45Z</dc:date>
    <item>
      <title>Eval total duration in minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462988#M191480</link>
      <description>&lt;P&gt;i've created a table from a project run that displays the time a run started, ended and what time files have been created during the run.&lt;/P&gt;

&lt;P&gt;However Im trying to do an eval to get the Total Duration in Minutes for each service which is&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 06:15:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462988#M191480</guid>
      <dc:creator>lavster</dc:creator>
      <dc:date>2019-08-28T06:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Eval total duration in minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462989#M191481</link>
      <description>&lt;P&gt;Hi lavster,&lt;BR /&gt;
I suggest to use a different approach to this kind of searches:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;at first stop to think to Splunk as a database!&lt;/LI&gt;
&lt;LI&gt;then don't use join because it's a very slow command!&lt;/LI&gt;
&lt;LI&gt;in addition, remember that there's the limit of 50,000 results for subsearches, so you cannot be sure to have all the results in subsearches used in joins;&lt;/LI&gt;
&lt;LI&gt;don't use fields with spaces (e.g. "ESLA File Start"), if you want, you can rename fields at the end of the search&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;So you should try to build something like this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=esla OR index=mule-new (State=START OR State=END) Service="Early SLA"
| bucket _time span=1d as Day 
| eval "ESLA File Start"=if(State="START",FileTime,""),"ESLA File End"=if(State="END",FileTime,""), Day=strftime(Day,"%d/%m/%Y")
| stats earliest(_time) as ESLA_Start latest(_time) as ESLA_End values( "ESLA File Start") AS  "ESLA File Start" values( "ESLA File End") AS  "ESLA File End" by Day
| eval st=strptime(ESLA_Start,"%H:%M:%S"), et=strptime("ESLA File End","%H:%M:%S"), diff=et-st, "ESLA_Total" = tostring(diff, "duration")
| table Day ESLA_Start ESLA_End "ESLA File Start" "ESLA File End" "ESLA_Total"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I cannot test it but the approach should be correct.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:29:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462989#M191481</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-08-28T11:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Eval total duration in minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462990#M191482</link>
      <description>&lt;P&gt;Thank you, i'll give this a go.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-total-duration-in-minutes/m-p/462990#M191482</guid>
      <dc:creator>lavster</dc:creator>
      <dc:date>2019-08-28T11:33:50Z</dc:date>
    </item>
  </channel>
</rss>

