how to log() when no free leases are available
Jeff Haran
jharan at Brocade.COM
Wed Jan 27 01:19:28 UTC 2010
Hi,
Couple of questions about logging.
I added the following to the beginning of my dhcpd.conf file:
log-facility daemon;
if not exists dhcp-client-identifier {
log ( error, concat( "dhcpd-brcd-error,",
"type=", binary-to-ascii(10, 8, ".", option dhcp-message-type), ",",
"hardware=", binary-to-ascii(16, 8, ":", substring(hardware, 1, 7)), ",",
"No Client ID"));
} elsif not exists vendor-class-identifier {
log ( error, concat( "dhcpd-brcd-error,",
"type=", binary-to-ascii(10, 8, ".", option dhcp-message-type), ",",
"hardware=", binary-to-ascii(16, 8, ":", substring(hardware, 1, 7)), ",",
"No Vendor ID"));
} else {
log ( info, concat( "dhcpd-brcd-info,",
"type=", binary-to-ascii(10, 8, ".", option dhcp-message-type), ",",
"hardware=", binary-to-ascii(16, 8, ":", substring(hardware, 1, 7)), ",",
"clientID=", substring(option dhcp-client-identifier, 1, 100), ",",
"vendorID=", option vendor-class-identifier));
}
It's in global scope, before my first subnet statement.
I find that if a lease is available for a client, it works pretty much as expected in that I see the following in the configured syslog file:
Jan 26 23:56:21 jharan-linux dhcpd: dhcpd-brcd-info,type=3,hardware=0:60:69:f0:0:80,clientID=BRCDBP-CP0-SLOT01-HOST00,vendorID=BROCADE
Jan 26 23:56:21 jharan-linux dhcpd: DHCPREQUEST for 192.168.74.80 from 00:60:69:f0:00:80 via eth0
Jan 26 23:56:21 jharan-linux dhcpd: DHCPACK on 192.168.74.80 to 00:60:69:f0:00:80 via eth0
However, when no free leases are available, my little custom log does not appear at all:
Jan 26 23:58:30 jharan-linux dhcpd: DHCPDISCOVER from 00:60:69:f0:00:80 via eth0: network backplane: no free leases
Jan 26 23:58:34 jharan-linux dhcpd: DHCPDISCOVER from 00:60:69:f0:00:80 via eth0: network backplane: no free leases
Q: Is there a trick to getting the log() statement in the config file to log something even when no leases are available?
What I want to see is logs of all DHCP traffic the server receives, not just the cases where it's successful at handing out a lease. It's the no free leases available case that I am trying to debug here. 8^)
Q: Is there some way to get dhcpd to log the name of the configuration file it's passed on the command line via the -cf parameter?
I am running version 4.0.0 of ISC dhcpd.
Thanks,
Jeff Haran
Brocade Communications
More information about the dhcp-users
mailing list