Zentyal Forum, Linux Small Business Server
Zentyal Server => Other modules => Topic started by: nbhanji on September 15, 2020, 03:45:19 pm
-
Hi,
Apologies, if this is discussed before, but cannot find it.
I have the DHCP logs being recorded in /var/log/dhcp/dhcp.log. I cannot find how to disable DHCP from writing to Syslog.
Can someone point me where I can find the info to disable ISC-DHCP-server from writing to Syslog file?
Thanks in advance.
-
:)
You need modify your zentyal dhcp.conf template and the rsyslog config.
sudo su -
mkdir -p /etc/zentyal/stubs/dhcp
cp /usr/share/zentyal/stubs/dhcp/dhcpd.conf.mas /etc/zentyal/stubs/dhcp/
Edit the /etc/zentyal/stubs/dhcp/dhcpd.conf.mas adding:
log-facility local7;
Your file has to have this aspect after editing:
etc...
# Cisco IP phones
option voip-tftp-servers code 150 = array of ip-address;
option shoretel-director-server code 155 = ip-address;
log-facility local7;
pid-file-name "<% $pidFile %>";
etc...
[code]
Open the */etc/rsyslog.d/50-default.conf* file and add this line:
[code]
local7.* -/var/log/dhcp.log
The file after editing should have this aspect:
... etc
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log
local7.* -/var/log/dhcp.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
etc...
[code]
Create the defined log file:
[code]
sudo touch /var/log/dhcp.log
sudo chown syslog:adm /var/log/dhcp.log
[code]
Restart rsyslog and dhcp:
[code]
systemctl restart rsyslog
zs dhcp restart
Check /var/log/dhcp.log
less /var/log/dhcp.log
You'll have the dhcp logs into the syslog file too if you maintain this line in */etc/rsyslog.d/50-default.conf*
*.*;auth,authpriv.none -/var/log/syslog
You'll have to remove the wildcard selector *.* and to use the explicit list of services that you want to store on syslog. Be cautious!
Cheers!