<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks, that does the trick. I'm surprised it is so convoluted to log
something as basic to the DHCP process as the MAC address.<br>
<br>
-------- Original Message  --------<br>
Subject: Re: Custom DHCP Logging<br>
From: Andre Mamitzsch <a class="moz-txt-link-rfc2396E" href="mailto:andre@mamitzsch.de"><andre@mamitzsch.de></a><br>
To: <a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@isc.org">dhcp-users@isc.org</a><br>
Date: Wednesday, March 12, 2008 4:03:50 PM<br>
<blockquote cite="mid:C3FE03C6.7469%25andre@mamitzsch.de" type="cite">
  <title>Re: Custom DHCP Logging</title>
>> Notice that any fields in the mac address that had leading
zeroes are now missing them. This makes matching difficult when looking
through the logs. <br>
  <br>
Here is the logging method we are using:<br>
  <br>
log(info, <br>
concat("DHCPEXTLOG for ", <br>
binary-to-ascii(10,8, ".", leased-address), " leased to ", <br>
concat (suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring( hardware, 1, 1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "",substring( hardware, 2, 1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring( hardware, 3, 1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring( hardware, 4, 1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring( hardware, 5, 1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring( hardware, 6, 1))),2), <br>
" via bridge ", <br>
concat (suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring(option agent.remote-id, 0,
1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "",substring(option agent.remote-id, 1,
1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring(option agent.remote-id, 2,
1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring(option agent.remote-id, 3,
1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring(option agent.remote-id, 4,
1))),2), <br>
":", <br>
suffix (concat <br>
("0", binary-to-ascii (16, 8, "", substring(option agent.remote-id, 5,
1))),2), <br>
" using vendor-identifier ", <br>
option vendor-class-identifier, <br>
"Modem Typ" <br>
) <br>
))); <br>
} <br>
  <br>
Regards,<br>
  <br>
Andre<br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <hr align="center" size="3" width="95%">Von: Blake Hudson
<a class="moz-txt-link-rfc2396E" href="mailto:blake@ispn.net"><blake@ispn.net></a><br>
Antworten an: <a class="moz-txt-link-rfc2396E" href="mailto:dhcp-users@isc.org"><dhcp-users@isc.org></a><br>
Datum: Wed, 12 Mar 2008 15:02:20 -0500<br>
An: <a class="moz-txt-link-rfc2396E" href="mailto:dhcp-users@isc.org"><dhcp-users@isc.org></a><br>
Betreff: Custom DHCP Logging<br>
  <br>
Hello, I'm having some trouble with custom logging in DHCP. I'd like to
log option 82 info with DHCP requests, using the following commands:<br>
  <br>
if exists agent.circuit-id and option dhcp-message-type = 3<br>
{<br>
# Log Circuit ID<br>
                log ( info, concat( "OPTION-82 for ", binary-to-ascii
(10, 8, ".",leased-address),<br>
                " from ",
substring(binary-to-ascii(16,8,":",hardware),2,24),<br>
                " Circuit ID: ", (option agent.circuit-id), "."));<br>
# Log Agent ID<br>
                log ( info, concat( "OPTION-82 for ", binary-to-ascii
(10, 8, ".",leased-address),<br>
                " from ",
substring(binary-to-ascii(16,8,":",hardware),2,24),<br>
               " Agent ID: " , (option agent.remote-id),"."));<br>
  <br>
}<br>
  <br>
This results in output similar to the following:<br>
Mar 12 12:52:20 mamba dhcpd: DHCPDISCOVER from 00:xx:xx:xx:05:5a via
xx.xx.70.1<br>
Mar 12 12:52:20 mamba dhcpd: DHCPOFFER on xx.xx.232.223 to
00:xx:xx:xx:05:5a via xx.xx.70.1<br>
Mar 12 12:52:20 mamba dhcpd: OPTION-82 for xx.xx.232.223 from
0:xx:xx:xx:5:5a Circuit ID: n25-1-vb18-482-vlan8<br>
Mar 12 12:52:20 mamba dhcpd: OPTION-82 for xx.xx.232.223 from
0:xx:xx:xx:5:5a Agetnt ID: N60-1-4-1-4-1-1<br>
Mar 12 12:52:20 mamba dhcpd: DHCPREQUEST for xx.xx.232.223
(xx.xx.64.17) from 00:xx:xx:xx:05:5a via xx.xx.70.1<br>
Mar 12 12:52:20 mamba dhcpd: DHCPACK on xx.xx.232.223 to
00:xx:xx:xx:05:5a via xx.xx.70.1<br>
  <br>
  <br>
Notice that any fields in the mac address that had leading zeroes are
now missing them. This makes matching difficult when looking through
the logs. <br>
  <br>
I've also tried using the dhcp-client-identifier with no luck, is there
a way to keep this information intact? How is the default logging
mechanism keeping this information whole?<br>
  <br>
Thanks,<br>
--Blake<br>
  <br>
</blockquote>
<br>
</body>
</html>