<HTML>
<HEAD>
<TITLE>Re: Custom DHCP Logging</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>>> 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%"><B>Von: </B>Blake Hudson <blake@ispn.net><BR>
<B>Antworten an: </B><dhcp-users@isc.org><BR>
<B>Datum: </B>Wed, 12 Mar 2008 15:02:20 -0500<BR>
<B>An: </B><dhcp-users@isc.org><BR>
<B>Betreff: </B>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>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Courier New"><SPAN STYLE='font-size:10.0px'>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>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><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>
</SPAN></FONT>
</BODY>
</HTML>