Using Unix | Logging the DHCP Service | Ubuntu/Mint | Posted 10.05.2010 by AndyM and NickF

Logging the DHCP Service

By default the ISC DHCP Server logs to the common-all-garden /var/log/messages which is fine, but I've always preferred a little log apartheid on my systems. This snippet shows how to make dhcpd log to its own, exclusive log file.

Firstly create the log file itself..

touch /var/log/dhcpd.log

The daemon which maintains the system logs is called syslog. Before modifying its config file, make a backup 'cos that's a good thing to do..

cp /etc/rsyslog.d/50-default.conf /etc/rsyslog.d/50-default.conf.bak

..then edit the file using your favourite text editor..

vi /etc/rsyslog.d/50-default.conf

Add the following directive to the end of the config file..

# dhcp log
!dhcpd
*.* /var/log/dhcpd.log

Finally restart the syslog service..

sudo restart rsyslog

Now when a new IP is given out, or the dhcpd daemon is restarted, the service will write to its own log file. Neat..