前言
環(huán)境:centos 7.9 keepalived-2.2.7
keepalived默認(rèn)日志路徑
默認(rèn)情況下,不管yum
安裝的keepalived
還是源碼編譯安裝的keepalived
,其都是受systemd
管理的,所以日志可以這樣看:
systemctl status keepalived.service -l
journalctl -u keepalived.service -f
tail -22f /var/log/messages | grep Keepalived
修改keepalived日志路徑
默認(rèn)的日志路徑太不友好,可以讓keepalived單獨(dú)輸出日志到指定文件,如下配置:文章來源:http://www.zghlxwxcb.cn/news/detail-671710.html
keepalived的環(huán)境變量配置默認(rèn)在 yum 安裝的在 /etc/sysconfig/keepalived ,源碼編譯安裝的在/usr/local/keepalived/etc/sysconfig/keepalived
文章來源地址http://www.zghlxwxcb.cn/news/detail-671710.html
[root@node2 ~]# vim /usr/local/keepalived/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 -S 0" #改這一句,添加-S 0
[root@node2 ~]# vim /etc/rsyslog.conf
#在下面這一行后面添加
# Save boot messages also to boot.log
local7.* /var/log/boot.log
#添加這一行
# save keepalived log to keepalived.log
local0.* /var/log/keepalived.log
[root@node1 sysconfig]# systemctl restart rsyslog #重啟rsyslog
[root@node1 sysconfig]# systemctl restart keepalived #重啟keepalived
[root@node1 sysconfig]# tail -222f /var/log/keepalived.log #keepalived的日志已經(jīng)成功指定到我們定義的文件了
Oct 15 20:49:20 node1 Keepalived[109485]: Starting Keepalived v2.2.7 (01/16,2022)
Oct 15 20:49:20 node1 Keepalived[109485]: Running on Linux 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 (built for Linux 3.10.0)
Oct 15 20:49:20 node1 Keepalived[109485]: Command line: '/usr/local/keepalived/sbin/keepalived' '-D' '-S' '0'
Oct 15 20:49:20 node1 Keepalived[109485]: WARNING - using deprecated default config file '/etc/keepalived/keepalived.conf' - please move to '/usr/local/etc/keepalived/keepalived.conf'
Oct 15 20:49:20 node1 Keepalived[109485]: Opening file '/etc/keepalived/keepalived.conf'.
Oct 15 20:49:20 node1 Keepalived[109485]: Configuration file /etc/keepalived/keepalived.conf
Oct 15 20:49:20 node1 Keepalived[109486]: NOTICE: setting config option max_auto_priority should result in better keepalived performance
Oct 15 20:49:20 node1 Keepalived[109486]: Starting VRRP child process, pid=109487
Oct 15 20:49:20 node1 Keepalived_vrrp[109487]: Registering Kernel netlink reflector
Oct 15 20:49:20 node1 Keepalived_vrrp[109487]: Registering Kernel netlink command channel
Oct 15 20:49:20 node1 Keepalived_vrrp[109487]: SECURITY VIOLATION - scripts are being executed but script_security not enabled.
Oct 15 20:49:20 node1 Keepalived_vrrp[109487]: Assigned address 192.168.118.132 for interface ens33
Oct 15 20:49:20 node1 Keepalived_vrrp[1
到了這里,關(guān)于keepalived的日志在哪里、配置keepalived日志路徑的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!