Submitting patch for additional logging

Niall O'Reilly Niall.oReilly at ucd.ie
Thu Oct 8 00:21:59 UTC 2009


Norman Elton wrote:
> We are working on a patch that will allow dhcpd to log the
> lease-length time for outgoing ACKs. This will allow us to keep better
> logs as to when particular leases are active. 

	You don't necessarily have to patch.

	I use the following in my domestic configuration, slightly
	modified from a suggestion which Frank Sweetser mailed to the
	list once.

# Thanks to Frank Sweetser (wpi.edu) for this logging config
on commit { if (static) {
     log (info, concat (
       "DHCPNETMON ",
       binary-to-ascii (10,32,"",encode-int (lease-time,32))," ",
       binary-to-ascii (16,8,":",substring (hardware, 1,6))," ",
       binary-to-ascii (10,8,".",leased-address)," ",
         "(", pick-first-value(host-decl-name, "--"),")",
           " static"));
   } else {
     log (info, concat (
       "DHCPNETMON ",
       binary-to-ascii (10,32,"",encode-int (lease-time,32))," ",
       binary-to-ascii (16,8,":",substring (hardware, 1,6))," ",
       binary-to-ascii (10,8,".",leased-address), " ",
         "(", pick-first-value(ddns-fwd-name, "--"),")",
           " dynamic"));
   }
}

	IIRC, this differs from Frank's idea only in that I trim
	the media-type byte before formatting.

	Here's the kind of log record that this generates, prefixed
	by whatever timestamp and other data your syslog normally
	inserts.

DHCPNETMON 43200 0:1c:bf:c0:40:3c 10.0.1.164 (--) dynamic

	This is as good an opportunity as any for me to thank Frank,
	and to apologise for not doing so before.

	ATB,
	/Niall





More information about the dhcp-users mailing list