启用keepalived独立日志功能
默认keepalived的日志属于LOG_DAEMON,记录在系统日志messages文件,可以实现独立日志文件记录自身日志
[root@ka1 keepalived]#vim /apps/keepalived/etc/sysconfig/keepalived
KEEPALIVED_OPTIONS="-D -S 6"
[root@ka1 keepalived]#vim /etc/rsyslog.conf
local6.* /var/log/keepalived.log
[root@ka1 keepalived]#systemctl restart keepalived.service rsyslog.service
[root@ka2 keepalived]#systemctl stop keepalived
[root@ka1 keepalived]#tail -f /var/log/keepalived.log
Apr 15 20:48:23 ka1 Keepalived_vrrp[2913]: Sending gratuitous ARP on eth0 for 10.0.0.10
Apr 15 20:48:23 ka1 Keepalived_vrrp[2913]: Sending gratuitous ARP on eth0 for 10.0.0.10
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: (ka2) Backup received priority 0 advertisement
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: (ka2) Receive advertisement timeout
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: (ka2) Entering MASTER STATE
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: (ka2) setting VIPs.
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: (ka2) Sending/queueing gratuitous ARPs on eth0 for 10.0.0.20
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: Sending gratuitous ARP on eth0 for 10.0.0.20
Apr 15 20:51:41 ka1 Keepalived_vrrp[2913]: Sending gratuitous ARP on eth0 for 10.0.0.20