DHCP Logging
Randall C Grimshaw
rgrimsha at syr.edu
Sat Jun 26 17:37:04 UTC 2010
This is basically how I log those values.
on commit {
log(error,
concat("Type=Commit",
"\t",
"MACaddress=",
binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)),
"\t",
"IPnumber=",
binary-to-ascii(10, 8, ".", leased-address),
"\t",
"VendClassId=",
pick-first-value(option vendor-class-identifier,"no-identifier"),
"\t",
"UserClass=",
pick-first-value( option user-class, "no-user-class" ),
"\t",
"Server=",
binary-to-ascii(10, 8, ".", option dhcp-server-identifier),
"\t",
"Hostname=",
pick-first-value(option host-name,"no-hostname")
)
);
}
Randall Grimshaw rgrimsha at syr.edu
________________________________________
From: dhcp-users-bounces+rgrimsha=syr.edu at lists.isc.org [dhcp-users-bounces+rgrimsha=syr.edu at lists.isc.org] On Behalf Of Blake Griffin [blake at ccfargo.com]
Sent: Saturday, June 26, 2010 12:32 AM
To: dhcp-users at lists.isc.org
Subject: DHCP Logging
I am trying to do detailed logging of DHCP and keep it in a standard format so that it can be sent to a mysql database with entries for type (set-top box or data), addy, mac, host-name, AID, CID, and event type (commit, release, expiry). I have multiple scenarios in which portions of this data is available. The scenarios are:
-set-top-box, no host-name, AID, no CID
-set-top-box, no host-name, AID, CID
-data, host-name, AID, CID
-data, host-name, AID, no CID
-data, no host-name, AID, CID
-data, no host-name, AID, no CID
I know this can be accomplished via combinations of if statements, etc. With the various scenarios, it can get very lengthy and convoluted. Im looking for a more elegant way to accomplish this.
So that I can just use one set of statements for on commit, on expiry, on release - is there a way so that when the CID or host-name does not exist, to set those options within the dhcpd.conf file to a specific text string to log (i.e. null or ----) . Also can you define variables within dhcpd.conf to be used within the log statements (i.e. – if option vendor-class-identifier = “STRING” TYPE = “STB OR DATA”).
Thanks,
Blake
More information about the dhcp-users
mailing list