centos7中的所有系统日志都为空
- 查看rsyslogd服务状态,发现有警告
systemctl status rsyslog
● rsyslog.service - System Logging Service
Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-12-27 10:27:19 CST; 3s ago
Docs: man:rsyslogd(8)
http://www.rsyslog.com/doc/
Main PID: 287830 (rsyslogd)
Tasks: 10
Memory: 944.0K
CGroup: /system.slice/rsyslog.service
└─287830 /usr/sbin/rsyslogd -n
Dec 27 10:27:19 salt-master2.sys.ops.bj1.wormpex.com systemd[1]: Starting System Logging Service...
Dec 27 10:27:19 salt-master2.sys.ops.bj1.wormpex.com rsyslogd[287830]: [origin software="rsyslogd" swVersion="8.24.0" x-pid="287830" x-info="http://www.rsyslog.com"] start
Dec 27 10:27:19 salt-master2.sys.ops.bj1.wormpex.com rsyslogd[287830]: warning: ~ action is deprecated, consider using the 'stop' statement instead [v8.24.0 try http://www.rsyslog.com/e/2307 ]
Dec 27 10:27:19 salt-master2.sys.ops.bj1.wormpex.com systemd[1]: Started System Logging Service.
Dec 27 10:27:19 salt-master2.sys.ops.bj1.wormpex.com rsyslogd[287830]: error during config processing: STOP is followed by unreachable statements! [v8.24.0 try http://www.rsyslog.com/e/2207 ]
- cat /etc/rsyslog.conf发现有个配置 & ~ 这个配置是忽略所有的日志。将这个配置注释掉重启服务解决。警告消失。日志可以打出来
[root@salt-master2.sys.ops.bj1.wormpex.com ~]# systemctl restart rsyslog
[root@salt-master2.sys.ops.bj1.wormpex.com ~]# systemctl status rsyslog
● rsyslog.service - System Logging Service
Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-12-27 10:29:44 CST; 5s ago
Docs: man:rsyslogd(8)
http://www.rsyslog.com/doc/
Main PID: 288237 (rsyslogd)
Tasks: 10
Memory: 1016.0K
CGroup: /system.slice/rsyslog.service
└─288237 /usr/sbin/rsyslogd -n
Dec 27 10:29:44 salt-master2.sys.ops.bj1.wormpex.com systemd[1]: Starting System Logging Service...
Dec 27 10:29:44 salt-master2.sys.ops.bj1.wormpex.com rsyslogd[288237]: [origin software="rsyslogd" swVersion="8.24.0" x-pid="288237" x-info="http://www.rsyslog.com"] start
Dec 27 10:29:44 salt-master2.sys.ops.bj1.wormpex.com systemd[1]: Started System Logging Service.