<?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 to write a search to find or track the host of a DHCP IP at a specific time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167934#M47856</link>
    <description>&lt;P&gt;This may help too: &lt;A href="http://blogs.splunk.com/2013/10/31/streamstats-example/" target="_blank"&gt;http://blogs.splunk.com/2013/10/31/streamstats-example/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It's an example of using streamstats but they specifically show how to look at when DHCP changes for an IP address. As to your point, if you need to search by MAC address, I would still recommend the above method. You can create a simple form dashboard that takes a MAC address and time range. You can create a search like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
host= sourcetype=dhcp mac_address=$mac$ | table _time, mac, hostname, ip_address, ...&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;When you submit a MAC address in the form, you can have it output data however you want but in this example it would output a table of results.&lt;/P&gt;

&lt;P&gt;If you consume DHCP logs with MAC and IP address, you should be able to correlate the MAC address to a given host.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:55:41 GMT</pubDate>
    <dc:creator>jlanders</dc:creator>
    <dc:date>2020-09-28T17:55:41Z</dc:date>
    <item>
      <title>How to write a search to find or track the host of a DHCP IP at a specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167930#M47852</link>
      <description>&lt;P&gt;I am trying to build a query so that anytime someone needs to find the host of a DHCP IP at a specific time (since they change often), it is possible to track them. However, this query has become quite difficult and I am seeking help from you Splunxperts out there. There are summaries (such as Assign, Renew, Release, Nack, Conflict) and I am looking for the best way to go about this. Below is some sample data. I envision when someone needs to find a host, they type the IP into this query (or dashboard) and it brings the host up for them.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;FirstOccurance&lt;/STRONG&gt;=1413379981.000&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;LastOccurance&lt;/STRONG&gt;=1413379981.000&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_hour&lt;/STRONG&gt;=13&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_mday&lt;/STRONG&gt;=15&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_minute&lt;/STRONG&gt;=33&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_month&lt;/STRONG&gt;=october&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_second&lt;/STRONG&gt;=1&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_wday&lt;/STRONG&gt;=wednesday&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_year&lt;/STRONG&gt;=2014&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;date_zone&lt;/STRONG&gt;=0&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;dest&lt;/STRONG&gt;=BIGRICHIE90.splunk.com&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;dest_ip&lt;/STRONG&gt;=123.45.67.890&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;dest_mac&lt;/STRONG&gt;=AA:BB:CC:11:22:DD&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;dns&lt;/STRONG&gt;=BIGRICHIE90.splunk.com&lt;BR /&gt;
&lt;STRONG&gt;dvc_host&lt;/STRONG&gt;=zzzaprot01&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;dvc_ip&lt;/STRONG&gt;=123.45.68.9 &lt;BR /&gt;
&lt;STRONG&gt;endTime&lt;/STRONG&gt;=1413379981.000&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;eventtype&lt;/STRONG&gt;=external-referer&lt;BR /&gt;&lt;BR /&gt;
                    visitor-type-referred &lt;BR /&gt;
&lt;STRONG&gt;host&lt;/STRONG&gt;=SPLSQL01&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;index&lt;/STRONG&gt;=network_dhcp&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;ip&lt;/STRONG&gt;=123.45.67.890&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;key&lt;/STRONG&gt;=AA:BB:CC:11:22:DD&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;leaseeventitemid&lt;/STRONG&gt;=10409011&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;mac&lt;/STRONG&gt;=AA:BB:CC:11:22:DD&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;nt_host&lt;/STRONG&gt;=BIGRICHIE90.splunk.com&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;sourcetype&lt;/STRONG&gt;=netw_DHCP (end network session start)&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;startTime&lt;/STRONG&gt;=1413379981.000&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;summary&lt;/STRONG&gt;=Assign&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;time&lt;/STRONG&gt;=1413379981.000&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;timeendpos&lt;/STRONG&gt;=45&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;timestartpos&lt;/STRONG&gt;=31&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;_time&lt;/STRONG&gt;=2014-10-15T09:33:01.000-04:00   &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:55:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167930#M47852</guid>
      <dc:creator>bigrichie90</dc:creator>
      <dc:date>2020-09-28T17:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find or track the host of a DHCP IP at a specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167931#M47853</link>
      <description>&lt;P&gt;I think this is best handled through a form-search-dashboard approach. You can start with the XML below and make it much more advanced by adding additional search fields. This XML would create a dashboard that lets the user put in an IP address and time range. When submitted, it'll execute your search and look for that IP address.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;IP Sample Dashboard&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;This dashboard accepts an IP address and gives you relevant logs for that address.&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="true" autoRun="false"&amp;gt;
    &amp;lt;input type="text" token="ipaddr" searchWhenChanged="false"&amp;gt;
      &amp;lt;label&amp;gt;IP Address&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="time" token="timer" searchWhenChanged="false"&amp;gt;
      &amp;lt;label&amp;gt;Time Range&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliestTime&amp;gt;-15m&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;

  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;event&amp;gt;
        &amp;lt;title&amp;gt;sample&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;dest=BIGRICHIE90.splunk.com dest_ip=123.45.67.890 dest_mac=AA:BB:CC:11:22:DD dns=BIGRICHIE90.splunk.com dvc_host=zzzaprot01 dvc_ip=$ipaddr$&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;$timer.earliest$&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime&amp;gt;$timer.latest$&amp;lt;/latestTime&amp;gt;
        &amp;lt;option name="list.drilldown"&amp;gt;full&amp;lt;/option&amp;gt;
        &amp;lt;option name="list.wrap"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="maxLines"&amp;gt;5&amp;lt;/option&amp;gt;
        &amp;lt;option name="raw.drilldown"&amp;gt;full&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="table.drilldown"&amp;gt;all&amp;lt;/option&amp;gt;
        &amp;lt;option name="table.wrap"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="type"&amp;gt;list&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
      &amp;lt;/event&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Oct 2014 02:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167931#M47853</guid>
      <dc:creator>jlanders</dc:creator>
      <dc:date>2014-10-16T02:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find or track the host of a DHCP IP at a specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167932#M47854</link>
      <description>&lt;P&gt;It should be noted that the search will probably need to be more generic to get good results...&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2014 02:12:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167932#M47854</guid>
      <dc:creator>jlanders</dc:creator>
      <dc:date>2014-10-16T02:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find or track the host of a DHCP IP at a specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167933#M47855</link>
      <description>&lt;P&gt;The main concern I have is actually querying accurate data. It is difficult to match the IP to the correct hostname when the IP is constantly changing.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2014 14:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167933#M47855</guid>
      <dc:creator>bigrichie90</dc:creator>
      <dc:date>2014-10-16T14:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find or track the host of a DHCP IP at a specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167934#M47856</link>
      <description>&lt;P&gt;This may help too: &lt;A href="http://blogs.splunk.com/2013/10/31/streamstats-example/" target="_blank"&gt;http://blogs.splunk.com/2013/10/31/streamstats-example/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It's an example of using streamstats but they specifically show how to look at when DHCP changes for an IP address. As to your point, if you need to search by MAC address, I would still recommend the above method. You can create a simple form dashboard that takes a MAC address and time range. You can create a search like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
host= sourcetype=dhcp mac_address=$mac$ | table _time, mac, hostname, ip_address, ...&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;When you submit a MAC address in the form, you can have it output data however you want but in this example it would output a table of results.&lt;/P&gt;

&lt;P&gt;If you consume DHCP logs with MAC and IP address, you should be able to correlate the MAC address to a given host.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:55:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-or-track-the-host-of-a-DHCP-IP-at/m-p/167934#M47856</guid>
      <dc:creator>jlanders</dc:creator>
      <dc:date>2020-09-28T17:55:41Z</dc:date>
    </item>
  </channel>
</rss>

