chroot DNS无法写日志到/var/log/messages解决办法

通常情况下,进程通过“/dev/log”向syslogd发送消息。由于“虚拟”根环境的限制,这种通信被禁止。因此syslogd需要改为监听“/var/named/chroot/dev/log”。可以通过编辑syslog的启动脚本来设定新的监听地点。
编辑syslog脚本(vi +24 /etc/rc.d/init.d/syslog),改变SYSLOGD_OPTIONS

[root@ns8 log]# cat /etc/rc.d/init.d/syslog   
#!/bin/bash  
#  
# syslog        Starts syslogd/klogd.  
#  
#  
# chkconfig: 2345 12 88  
# description: Syslog is the facility by which many daemons use to log \  
# messages to various system log files.  It is a good idea to always \  
# run syslog.  
### BEGIN INIT INFO  
# Provides: $syslog  
### END INIT INFO  
 
# Source function library. 
. /etc/init.d/functions  
 
[ -f /sbin/syslogd ] || exit 0  
[ -f /sbin/klogd ] || exit 0  
 
# Source config  
if [ -f /etc/sysconfig/syslog ] ; then  
        . /etc/sysconfig/syslog  
else  
        #SYSLOGD_OPTIONS="-m 0" 
        SYSLOGD_OPTIONS="-m 0 -a /var/named/chroot/dev/log" #修改此处
        KLOGD_OPTIONS="-2" 
fi  
... 
[root@ns8 log]# vi /etc/sysconfig/syslog   
 
# Options to syslogd  
# -m 0 disables 'MARK' messages.  
# -r enables logging from remote machines  
# -x disables DNS lookups on messages recieved with -r  
# See syslogd(8) for more details  
#SYSLOGD_OPTIONS="-m 0" 
SYSLOGD_OPTIONS="-m 0 -a /var/named/chroot/dev/log" #修改此处
# Options to klogd  
# -2 prints all kernel oops messages twice; once for klogd to decode, and  
#    once for processing with 'ksymoops'  
# -x disables all klogd processing of oops messages entirely  
# See klogd(8) for more details  
KLOGD_OPTIONS="-x" 

发表评论