Keepalived日志分离配置

Keepalived日志默认是在系统日志下的/var/log/messages,此时我们可以对其进行日志分离,将Keepalived的日志单独写入至我们配置好的路径中


vi /etc/sysconfig/keepalived

KEEPALIVED_OPTIONS="-D -S 0 -d"

vi /etc/rsyslog.conf

#这里的0对应着上方配置的-S 0
local0.* /etc/keepalived/keepalived.log

重启rsyslog和Keepalived

systemctl restart rsyslog

/etc/init.d/keepalived restart

此时,keepalived日志就被分离了

tail -f /var/log/keepalived.log

Mar 31 20:00:11 localhost Keepalived_vrrp[66755]:     192.168.36.199/24 dev ens33 scope global
Mar 31 20:00:11 localhost Keepalived_vrrp[66755]: Using LinkWatch kernel netlink reflector...
Mar 31 20:00:11 localhost Keepalived_vrrp[66755]: VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
Mar 31 20:00:11 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) Transition to MASTER STATE
Mar 31 20:00:11 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Mar 31 20:00:12 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) Entering MASTER STATE
Mar 31 20:00:12 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) setting protocol VIPs.
Mar 31 20:00:12 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) Sending gratuitous ARPs on ens33 for 192.168.36.199
Mar 31 20:00:12 localhost Keepalived_healthcheckers[66754]: Netlink reflector reports IP 192.168.36.199 added
Mar 31 20:00:17 localhost Keepalived_vrrp[66755]: VRRP_Instance(VI_1) Sending gratuitous ARPs on ens33 for 192.168.36.199

 

posted @ 2022-03-30 09:20  RFAA  阅读(219)  评论(0编辑  收藏  举报