<?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: Use field as _time in lookup does not work in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372079#M5700</link>
    <description>&lt;P&gt;can you try &lt;CODE&gt;%6N&lt;/CODE&gt; instead of &lt;CODE&gt;%9N&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 20:08:38 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-11-15T20:08:38Z</dc:date>
    <item>
      <title>Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372078#M5699</link>
      <description>&lt;P&gt;Hi to all, i have a csv like:&lt;/P&gt;

&lt;P&gt;host,last_report_time&lt;BR /&gt;
host1,2017-07-28-14.23.00.000000&lt;BR /&gt;
host2,2017-11-15-06.44.00.000000&lt;BR /&gt;
host3,2017-11-15-06.13.00.000000&lt;BR /&gt;
host4,2017-10-18-01.53.00.000000&lt;/P&gt;

&lt;P&gt;i'm trying to use the field last_report_time in this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lastReportTime.csv |eval _time=strptime(last_report_time,"%Y-%m-%d-%H.%M.%S.%9N")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it does not work.&lt;BR /&gt;
Even if i change di time range, i get all records.&lt;/P&gt;

&lt;P&gt;What is wrong?&lt;/P&gt;

&lt;P&gt;Thanks and regards.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:48:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372078#M5699</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2020-09-29T16:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372079#M5700</link>
      <description>&lt;P&gt;can you try &lt;CODE&gt;%6N&lt;/CODE&gt; instead of &lt;CODE&gt;%9N&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 20:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372079#M5700</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-15T20:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372080#M5701</link>
      <description>&lt;P&gt;The timerange filter, based on _time field, only works on indexed data. If you expect to apply filter based on your time range picker in the search, you would need to use following workaround. (fixed strptime time format as well)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lastReportTime.csv |eval _time=strptime(last_report_time,"%Y-%m-%d-%H.%M.%S.%N")
| where _time&amp;gt;=[|gentimes start=-1  | addinfo | table info_min_time | rename info_min_time as search ] AND _time&amp;lt;[|gentimes start=-1  | addinfo | table info_max_time | rename info_max_time as search ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The addinfo command adds the current time range as field info_min_time (earliest) and info_max_time (latest). The subsearches return those times and apply filter based on it.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372080#M5701</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T16:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372081#M5702</link>
      <description>&lt;P&gt;Thanks, this works! But i think that i took the hard way to solve my problem.&lt;BR /&gt;
What i need it's just to tell Splunk to consider the field 'last_report_time' as a date, because what i need is generate a pie chart (in an SDK application) with, for example, host with 'last_report_time' older than 3 month and all other host.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372081#M5702</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2020-09-29T16:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372082#M5703</link>
      <description>&lt;P&gt;Ok. For that you probably need to create a field say category and set it's value by comparing relative_time (now()... with last_report_time.  e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lastReportTime.csv |eval _time=strptime(last_report_time,"%Y-%m-%d-%H.%M.%S.%N")
| eval category=if(_time&amp;gt;=relative_time(now(),"-3mon"),"Older than 3 months","All other hosts")
| stats count by category
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372082#M5703</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T16:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Use field as _time in lookup does not work</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372083#M5704</link>
      <description>&lt;P&gt;just arrived me too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lastReportTime.csv | rex field=last_report_time "(?&amp;lt;date&amp;gt;\d{4}-\d{2}-\d{2})\-" | eval _time=strptime(date,"%Y-%m-%d") | eval myrange=if(_time&amp;gt;relative_time(now(), "-90d@d"), "Last 3 months", "Older than 3 months") | stats count by myrange
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;P.S: exactly somesoni2, thanks very much!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Use-field-as-time-in-lookup-does-not-work/m-p/372083#M5704</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2017-11-15T22:53:09Z</dc:date>
    </item>
  </channel>
</rss>

