/var/log/message, /var/log/secure等都不记录了,并且都是空文件。
重启机器:reboot 无效
重启日志: systemctl start rsyslog 无效
怀疑空间不足,删除/var/log/messages,重新运行rsyslog 无效
重装下rsyslog,于是yum reinstall rsyslog,重新运行rsyslog 无效
找到配置文件 /etc/rsyslog.conf
修改如下:
解注释:#$ModLoad imklog # reads kernel messages (the same are read from journald)
修改为:$ModLoad imklog # reads kernel messages (the same are read from journald)
增加注释:$OmitLocalLogging on
修改为:#$OmitLocalLogging on
增加注释:$IMJournalStateFile imjournal.state
修改为:#$IMJournalStateFile imjournal.state
重启日志:systemctl restart rsyslog
tai日志:tail -f /var/log/messages 可以了
注意默认centos7是注释掉#$ModLoad imklog # reads kernel messages (the same are read from journald)这段的