<?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: inputcsv with time range query in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167324#M3670</link>
    <description>&lt;P&gt;Did this work?&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jul 2015 02:07:16 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-07-18T02:07:16Z</dc:date>
    <item>
      <title>inputcsv with time range query</title>
      <link>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167322#M3668</link>
      <description>&lt;P&gt;&lt;STRONG&gt;test.csv contents:&lt;/STRONG&gt;&lt;BR /&gt;
capture_time,leased_ip&lt;BR /&gt;
20150616235926,192.168.2.23&lt;BR /&gt;
20150318205845,10.10.23.1&lt;BR /&gt;
20150512195955,192.168.27.2&lt;BR /&gt;
20150417154505,192.168.64.6&lt;BR /&gt;
20150615222505,10.10.100.6&lt;BR /&gt;
20150303213322,10.10.22.18&lt;BR /&gt;
20150616233103,192.168.87.2&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;dhcp lease log events will capture the following fields only:&lt;/STRONG&gt;&lt;BR /&gt;
1. lease_time       -&amp;gt; lease timestamp&lt;BR /&gt;
2. leased_ip        -&amp;gt; leased ip address&lt;BR /&gt;
3. userid       -&amp;gt; user&lt;BR /&gt;
4. session      -&amp;gt; either "START or STOP"&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;Notes:&lt;/STRONG&gt; &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;the user can use the leased IP for a maximum of 21 days before it requrests for a new IP.

&lt;UL&gt;
&lt;LI&gt;this means that the "capture time" could be 21 days after the "lease time"

&lt;OL&gt;
&lt;LI&gt;the content of the CSV input file can range from 1 to 2000&lt;/LI&gt;
&lt;/OL&gt;&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;STRONG&gt;Objective:&lt;/STRONG&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;capture the culprit&lt;/LI&gt;
&lt;LI&gt;find the first matching userid using the leased ip address(ip) with a "lease_timestamp" before the "capture_time" based on the csv file&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Desired Output Table:&lt;/P&gt;

&lt;H2&gt;userid, leased_ip, lease_time, capture_time&lt;/H2&gt;

&lt;P&gt;I have the search command below for a start. But i cannot figure out how do a time range search for each capture time in the csv file.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;index=dhcp_leaselog&lt;BR /&gt;
| search [|inputcsv test.csv | fields leased_ip]&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;If i do "&lt;EM&gt;| fields leased_ip capture_time&lt;/EM&gt;", obviously it cannot match anything because capture_time is not equal to the lease_time&lt;/P&gt;

&lt;P&gt;I'm currently looking at "gentimes" but I'm not sure if it is the correct command to use for this case or considering on switching to "inputlookup".  &lt;/P&gt;

&lt;P&gt;Any suggestions are very much appreciated. Thank You!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167322#M3668</guid>
      <dc:creator>joeyfeb</dc:creator>
      <dc:date>2020-09-28T20:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: inputcsv with time range query</title>
      <link>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167323#M3669</link>
      <description>&lt;P&gt;You need &lt;CODE&gt;map&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputcsv test.csv | map search="search index=dhcp_leaselog leased_ip=$leased_ip$ | where lease_timestamp&amp;lt;$capture_time$ | dedup | eval capture_time=$capture_time$ | eval leased_ip=$leased_ip$ | fields userid, leased_ip, lease_time, capture_time"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jun 2015 13:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167323#M3669</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-19T13:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: inputcsv with time range query</title>
      <link>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167324#M3670</link>
      <description>&lt;P&gt;Did this work?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2015 02:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/inputcsv-with-time-range-query/m-p/167324#M3670</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-18T02:07:16Z</dc:date>
    </item>
  </channel>
</rss>

