<?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: Convert string to date then filter by only dates within the last 48 hours in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335899#M62110</link>
    <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2017 19:34:10 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-06-05T19:34:10Z</dc:date>
    <item>
      <title>Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335893#M62104</link>
      <description>&lt;P&gt;I have a variable that produces many strings but I need to convert them to a date value then filter by only the dates that are within the last 48 hours&lt;/P&gt;

&lt;P&gt;I have this query so far but it isn't working, any ideas what I am doing incorrectly?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup report.csv 
| rename u_last_policyrequest_time as "Last Policy Request" 
| search "Last Policy Request"=* 
| fields "Last Policy Request" 
| eval Last_Policy_Request = strptime("Last Policy Request", "%m/%d/%Y %H:%M") 
| where Last_Policy_Request &amp;lt; relative_time(now(),”-48h”)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 16:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335893#M62104</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-06-05T16:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335894#M62105</link>
      <description>&lt;P&gt;Line #6 is selecting events that are more than 48 hours old.  Try &lt;CODE&gt;| where Last_Policy_Request &amp;gt; relative_time(now(),”-48h”)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 16:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335894#M62105</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-05T16:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335895#M62106</link>
      <description>&lt;P&gt;Tried that with the last 200 days and didn't get any results (Should have provided all results) I am afraid I am not converting it to a date string correctly because even after removing %H:%M I still get results that look like this:&lt;/P&gt;

&lt;P&gt;5/12/2017 15:22&lt;BR /&gt;
5/17/2017 14:55&lt;BR /&gt;
5/5/2017 20:04&lt;BR /&gt;
5/17/2017 14:46&lt;BR /&gt;
5/17/2017 15:01&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 16:48:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335895#M62106</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-06-05T16:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335896#M62107</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
&lt;STRONG&gt;Updated the where clause logic&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup report.csv | search u_last_policyrequest_time=*
| fields u_last_policyrequest_time
| eval Last_Policy_Request = strptime(u_last_policyrequest_time, "%m/%d/%Y %H:%M") 
 | where Last_Policy_Request &amp;gt; relative_time(now(),"-48h")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 16:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335896#M62107</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-05T16:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335897#M62108</link>
      <description>&lt;P&gt;It might help to see some sample data.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 17:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335897#M62108</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-05T17:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335898#M62109</link>
      <description>&lt;P&gt;I am now getting all of the results:&lt;/P&gt;

&lt;P&gt;I should be getting 0 of them.&lt;/P&gt;

&lt;P&gt;5/12/2017 15:22 1494620520.000000&lt;BR /&gt;
5/17/2017 14:55 1495050900.000000&lt;BR /&gt;
5/5/2017 20:04  1494032640.000000&lt;BR /&gt;
5/17/2017 14:46 1495050360.000000&lt;BR /&gt;
5/17/2017 15:01 1495051260.000000&lt;BR /&gt;
5/17/2017 14:38 1495049880.000000&lt;BR /&gt;
5/15/2017 13:22 1494872520.000000&lt;BR /&gt;
5/5/2017 15:50  1494017400.000000&lt;BR /&gt;
5/17/2017 14:26 1495049160.000000&lt;BR /&gt;
5/17/2017 15:01 1495051260.000000&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 19:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335898#M62109</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-06-05T19:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335899#M62110</link>
      <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 19:34:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335899#M62110</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-05T19:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to date then filter by only dates within the last 48 hours</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335900#M62111</link>
      <description>&lt;P&gt;Awesome, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 19:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-string-to-date-then-filter-by-only-dates-within-the-last/m-p/335900#M62111</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-06-05T19:37:18Z</dc:date>
    </item>
  </channel>
</rss>

