以前配置keepalived时候所有的日志都是写入到/var/log/message下的,由于message的日志太多了而keepalived的日志又很那分离出来,所以研究了一下keepalived的日志设置。
具体操作步骤如下:因为我的keepalived 是./configure 默认配置安装。
然后使用的以下操作命令
    cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/keepalived
    cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/keepalived 
    cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
    cp /usr/local/sbin/keepalived /sbin/keepalived
我们只需要修改 /etc/sysconfig/keepalived 就可以了
把KEEPALIVED_OPTIONS="-D" 修改为KEEPALIVED_OPTIONS="-D -d -S 0"
最后设置syslog,修改/etc/rsyslog.conf
最后添加:
# keepalived -S 0 
local0.*                                                /var/log/keepalived.log
重新启动日志
/etc/init.d/rsyslog restart
使用以下命令进行验证
/etc/init.d/keepalived restart;tailf /var/log/keepalived.log