How to colorize dhcpd logs
On some linux grep will make some colors. With
export GREP_COLOR='01;34'
you can change the grep color.
tail -f /var/log/messages | grep "\(10.151.37.[12]..\|10.146.55.[12]..\)"
If you like to colorize some more statements use
tail -f /var/log/messages | sed -f /root/.coloriselog | grep "\(10.151.37.[12]..\|10.146.55.[12]..\)"
with the
sed
script (in this case
/root/.coloriselog
)
s/unknown\ network\ segment/\x1b[31munknown network segment\x1b[39m/g
s/ignored/\x1b[31mignored \x1b[39m/g
s/BOOTP\ from\ dynamic\ client\ and\ no\ dynamic\ leases/\x1b[31mBOOTP from dynamic client and no dynamic leases\x1b[39m/g
s/no\ free/\x1b[31mno\ free\x1b[39m/g
s/not\ found/\x1b[31mnot found\x1b[39m/g
s/unknown\ lease/\x1b[31munknown lease\x1b[39m/g
s/wrong\ network/\x1b[31mwrong network\x1b[39m/g
s/network\ unknown/\x1b[31mnetwork unknown\x1b[39m/g
s/unknown\ subnet/\x1b[31munknown subnet\x1b[39m/g
s/DHCPNAK/\x1b[31mDHCPNAK\x1b[39m/g
s/DHCPDECLINE/\x1b[31mDHCPDECLINE\x1b[39m/g
s/DHCPACK/\x1b[32mDHCPACK\x1b[39m/g
Usefull link to determin colors