重启rsyslog服务时出现问题(误删/var/log/messages解决方案)

来源:互联网 发布:淘宝网天猫女装冬装 编辑:程序博客网 时间:2024/06/05 01:10
今天修改了/etc/rsyslog.conf中的内容后,想着要通过systemctl restart rsyslog重启服务,但是执行完命令后,总感觉/etc/rsyslog.conf中修改的内容没有生效。
于是乎就去看了下/var/log/messages下的日志文件,发现有这样一行提示:Mar  1 21:33:39 localhost rsyslogd-2027: imjournal: fscanf on state file `/var/lib/rsyslog/imjournal.state' failed

接着将这行提示放到网上搜索了一番终于找到一篇解答,地址如下:
http://unix.stackexchange.com/questions/124942/rsyslog-not-logging

注意到这篇有这样几行:
When this issue occurs, you can delete /var/lib/rsyslog/imjournal.state and restart the daemon as a workaround.

rsyslog doesn't handle the date directly but only through the systemd API. I've checked the code in imjournal a while ago and this looks like an issue in systemd.


意思是说把/var/lib/rsyslog/imjournal.state文件删掉,然后在执行systemctl restart rsyslog命令,这样/etc/rsyslog.conf修改的内容就会生效。

验证了下,还真的可以。
0 0