<?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 do you filter results after using the tostring &amp;quot;duration&amp;quot;? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426430#M74757</link>
    <description>&lt;P&gt;Thanks @whrg, that did the trick! So it seems basically all time is dumbed down into seconds as a base, good to know!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Dec 2018 17:46:46 GMT</pubDate>
    <dc:creator>pmhelfrich</dc:creator>
    <dc:date>2018-12-10T17:46:46Z</dc:date>
    <item>
      <title>How do you filter results after using the tostring "duration"?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426428#M74755</link>
      <description>&lt;P&gt;I used the answer from this thread to create my query, but I can't figure out how to narrow them down.&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/108248/tostring-x-duration-working-wierd.html"&gt;https://answers.splunk.com/answers/108248/tostring-x-duration-working-wierd.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I'm trying to show only the results where OLDEST_ECA Date/time is older than 12 hrs from now so I can trigger an alert. The difference can span up to days/weeks. I have the calculation showing the results appropriately, but can't figure out the filtering part.&lt;/P&gt;

&lt;P&gt;OLDEST_ECA stored as: 2018-12-06 18:26:16.486&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval OLDEST = strptime(OLDEST_ECA, "%Y-%m-%d %H:%M:%S")
| eval NOW_DATE = strftime(now(), "%Y-%m-%d %H:%M:%S")
| eval diff = tostring((now() - OLDEST), "duration")
| Table OLDEST_ECA NOW_DATE OLDEST NOW diff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OLDEST_ECA               NOW_DATE                     OLDEST          NOW            diff
2018-12-06 08:00:56.831 2018-12-07 14:31:56 1544104856.000000   1544214716  1+06:31:00.000000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Dec 2018 20:34:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426428#M74755</guid>
      <dc:creator>pmhelfrich</dc:creator>
      <dc:date>2018-12-07T20:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you filter results after using the tostring "duration"?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426429#M74756</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval OLDEST = strptime(OLDEST_ECA, "%Y-%m-%d %H:%M:%S")
| where now()-OLDEST&amp;lt;12*3600
...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Dec 2018 09:10:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426429#M74756</guid>
      <dc:creator>whrg</dc:creator>
      <dc:date>2018-12-08T09:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you filter results after using the tostring "duration"?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426430#M74757</link>
      <description>&lt;P&gt;Thanks @whrg, that did the trick! So it seems basically all time is dumbed down into seconds as a base, good to know!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 17:46:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-filter-results-after-using-the-tostring-quot-duration/m-p/426430#M74757</guid>
      <dc:creator>pmhelfrich</dc:creator>
      <dc:date>2018-12-10T17:46:46Z</dc:date>
    </item>
  </channel>
</rss>

