<?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 Convert negative seconds to duration in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-negative-seconds-to-duration/m-p/227662#M67245</link>
    <description>&lt;P&gt;I have a column of seconds, some of which are negative (representing an outage).  I want to use &lt;CODE&gt;tostring(duration, "duration")&lt;/CODE&gt; on the column, but that doesn't work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval count=-5 | eval duration=tostring(count, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Mar 2016 10:55:05 GMT</pubDate>
    <dc:creator>joxley</dc:creator>
    <dc:date>2016-03-03T10:55:05Z</dc:date>
    <item>
      <title>Convert negative seconds to duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-negative-seconds-to-duration/m-p/227662#M67245</link>
      <description>&lt;P&gt;I have a column of seconds, some of which are negative (representing an outage).  I want to use &lt;CODE&gt;tostring(duration, "duration")&lt;/CODE&gt; on the column, but that doesn't work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval count=-5 | eval duration=tostring(count, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Mar 2016 10:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-negative-seconds-to-duration/m-p/227662#M67245</guid>
      <dc:creator>joxley</dc:creator>
      <dc:date>2016-03-03T10:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert negative seconds to duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-negative-seconds-to-duration/m-p/227663#M67246</link>
      <description>&lt;P&gt;Absolute the duration in the conversion and prepend it with a - or empty string.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval count=-5 | eval duration=if(count&amp;lt;0, "-", "") + tostring(abs(count), "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Mar 2016 10:56:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-negative-seconds-to-duration/m-p/227663#M67246</guid>
      <dc:creator>joxley</dc:creator>
      <dc:date>2016-03-03T10:56:39Z</dc:date>
    </item>
  </channel>
</rss>

