Keepalived默认日志存放在系统日志:/var/log/messages下
若需要日志单独存放,要修改/etc/sysconfig/keepalived
KEEPALIVED_OPTIONS="-D" 修改为:KEEPALIVED_OPTIONS="-D -d -S 0"

[root@sre /]# vim /etc/sysconfig/keepalived 
# Options for keepalived. See `keepalived --help' output and keepalived(8) and
# keepalived.conf(5) man pages for a list of all options. Here are the most
# common ones :
#
# --vrrp               -P    Only run with VRRP subsystem.
# --check              -C    Only run with Health-checker subsystem.
# --dont-release-vrrp  -V    Dont remove VRRP VIPs & VROUTEs on daemon stop.
# --dont-release-ipvs  -I    Dont remove IPVS topology on daemon stop.
# --dump-conf          -d    Dump the configuration data.
# --log-detail         -D    Detailed log messages.
# --log-facility       -S    0-7 Set local syslog facility (default=LOG_DAEMON)
#

KEEPALIVED_OPTIONS="-D -d -S 0"

在/etc/rsyslog.conf 末尾添加

[root@sre /]# vim /etc/rsyslog.conf 
local0.*                                                /var/log/keepalived.log

重启日志记录服务 重启keepalived

service rsyslog restart
service keepalived restart

查看日志

tail -f /var/log/keepalived.log 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code