I need to parse dhcpd.leases to store data in mysql

George C. Kaplan gckaplan at ack.berkeley.edu
Fri Jun 30 16:24:29 UTC 2006

Simon Hobson wrote:
> Brent L. Bates wrote:
>>     Could the syslog output be of any help for the person trying to log
>>everything to his MySQL data base?  He could have all this output sent to its
>>own log file.  I know the default output doesn't have all the information he
>>needs.  However, are there any `ifdefs' that might turn this information on
>>and log it?  If not, how difficult would it be to modify the source to do so?
>> Just some ideas.
> A good point. Another option would be to use the "on <action> ..." 
> external links, eg "on commit <call code to add record to database>". 
> Though care needs to be taken when using these not to introduce too 
> much latency into the server.

To avoid problems with latency, it's very easy to use "on commit {log
...}" to generate a syslog entry (with client MAC, IP, lease duration)
every time a lease is issued or renewed.  The syslog entries are much
easier to parse for database processing, and it's strictly serialized;
you don't have to deal with the daemon rewriting the leases file

George C. Kaplan                            gckaplan at ack.berkeley.edu
Communication & Network Services            510-643-0496
University of California at Berkeley

More information about the dhcp-users mailing list