<?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: When using the transaction command, how do I format the duration into H:M:S? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269768#M81190</link>
    <description>&lt;P&gt;Ok, I can see the problem.&lt;BR /&gt;
I made a mistake when I copied and pasted your code.&lt;/P&gt;

&lt;P&gt;Instead of strftime you have to use the tostring function for JobDuration.&lt;/P&gt;

&lt;P&gt;That is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval JobDuration = tostring(duration, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps. I have already fixed my two answers below.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2016 09:39:59 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-02-08T09:39:59Z</dc:date>
    <item>
      <title>When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269763#M81185</link>
      <description>&lt;P&gt;I'm sure this may have been asked before. When using transaction, I would like to format the duration into &lt;CODE&gt;H:M:S&lt;/CODE&gt;, my search results for &lt;STRONG&gt;jobduration&lt;/STRONG&gt; looks like 19 is being added to the result. Any help is appreciated.&lt;/P&gt;

&lt;P&gt;Search is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tws_merged (job_cpu_name ="cclita*" OR job_cpu_name ="cplisa3*" OR job_cpu_name = "cpaisa*f" OR job_cpu_name="lp0d7*") job_stream_name!="UNIXDLY" | transaction job_name host startswith"Jobman streamed" endswith="has completed SUCCESSFULLY" | eval Date=strftime(_time, "%m-%d-%y") | eval JobDuration=strftime(duration, "%H:%M:%S") | table Date job_name JobDuration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;02-03-16    ELSHPCST    02:56:52
02-04-16    ELVALRTD    19:00:00
02-04-16    ELVALRTPE   19:00:00
02-04-16    ELVALOOS    19:00:00
02-04-16    ELVALRTD    19:00:00
02-04-16    ELVALRTPE   19:00:00
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 21:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269763#M81185</guid>
      <dc:creator>clarksinthehill</dc:creator>
      <dc:date>2016-02-04T21:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269764#M81186</link>
      <description>&lt;P&gt;Use this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval JobDuration = tostring(duration, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 21:40:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269764#M81186</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-04T21:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269765#M81187</link>
      <description>&lt;P&gt;Thanks for the reply, using the above my results now include duration as a string. Any ideas?&lt;/P&gt;

&lt;P&gt;02-05-16    ELINVPUB    duration&lt;BR /&gt;
02-05-16    ELLKPPARN   duration&lt;BR /&gt;
02-05-16    ELVALRTD    duration&lt;BR /&gt;
02-05-16    ELVALRTD    duration&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269765#M81187</guid>
      <dc:creator>clarksinthehill</dc:creator>
      <dc:date>2016-02-05T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269766#M81188</link>
      <description>&lt;P&gt;Errrm, that shouldn't be the case unless your duration field is not a valid duration.&lt;BR /&gt;
Can you post your whole query here?&lt;BR /&gt;
Based on your comments it should be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tws_merged (job_cpu_name ="cclita*" OR job_cpu_name ="cplisa3*" OR job_cpu_name = "cpaisa*f" OR job_cpu_name="lp0d7*") job_stream_name!="UNIXDLY" 
| transaction job_name host startswith"Jobman streamed" endswith="has completed SUCCESSFULLY" 
| eval Date = strftime(_time, "%m-%d-%y") 
| eval JobDuration = tostring(duration, "duration")
| table Date, job_name,  JobDuration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:42:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269766#M81188</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-05T16:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269767#M81189</link>
      <description>&lt;P&gt;Sure - it is.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tws_merged (job_cpu_name ="cclita*" OR job_cpu_name ="cplisa3*" OR job_cpu_name = "cpaisa*f" OR job_cpu_name="lp0d7*") job_stream_name!="UNIXDLY" 
 | transaction job_name host startswith"Jobman streamed" endswith="has completed SUCCESSFULLY" 
 | eval Date = strftime(_time, "%m-%d-%y") 
 | eval JobDuration = strftime(duration, "duration")
 | table Date, job_name,  JobDuration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 18:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269767#M81189</guid>
      <dc:creator>clarksinthehill</dc:creator>
      <dc:date>2016-02-05T18:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269768#M81190</link>
      <description>&lt;P&gt;Ok, I can see the problem.&lt;BR /&gt;
I made a mistake when I copied and pasted your code.&lt;/P&gt;

&lt;P&gt;Instead of strftime you have to use the tostring function for JobDuration.&lt;/P&gt;

&lt;P&gt;That is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval JobDuration = tostring(duration, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps. I have already fixed my two answers below.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 09:39:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269768#M81190</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-08T09:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269769#M81191</link>
      <description>&lt;P&gt;Perfect! Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 15:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269769#M81191</guid>
      <dc:creator>clarksinthehill</dc:creator>
      <dc:date>2016-02-08T15:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: When using the transaction command, how do I format the duration into H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269770#M81192</link>
      <description>&lt;P&gt;No worries. If this is resolved please remember to mark is as answered so that others can benefit from it in the future.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 15:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-the-transaction-command-how-do-I-format-the-duration/m-p/269770#M81192</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-08T15:28:51Z</dc:date>
    </item>
  </channel>
</rss>

