您的位置:首页 > 运维架构 > Linux

【翻译自mos文章】Linux的/var/log/messages是空的(0k),messages.0, messages.1也是空的

2016-03-13 12:47 501 查看
Linux的/var/log/messages是空的(0k),messages.0, messages.1也是空的

来源于:

The /var/log/messages is empty, and so are the rotated log files such as messages.0, messages.1,... (文档 ID 2053885.1)

适用于:

Linux OS - Version Enterprise Linux 4.0 to Oracle Linux 7.1 with Unbreakable Linux Kerne l[3.8.13] [Release RHEL4 to OL7U1]

Linux x86-64

Linux x86

症状:

在Oracle Linux上,messages 文件是空的,messages.1,messages.2等rotated files也是空的( rotated 产生的message文件名依赖于 /etc/logrotate.conf配置文件)

# cd /var/log
ls -larth messages*
-rwxrwxrwx 1 root root 0 Aug 8 22:32 messages.4
-rwxrwxrwx 1 root root 0 Aug 15 22:32 messages.3
-rwxrwxrwx 1 root root 0 Aug 22 22:32 messages.2
-rwxrwxrwx 1 root root 0 Aug 29 22:32 messages.1
-rwxrwxrwx 1 root root 0 Sep 5 22:32 messages

原因:

/etc/syslog.conf 文件被修改过,比如,注释掉了下面的行:

$ grep /var/log/messages /etc/syslog.conf 
#*.info;mail.none;news.none;authpriv.none;cron.none /var/log/messages --------->>>注意最前面的#符号

解决方案:

1.取消注释/etc/syslog.conf (/etc/rsyslog.conf on OL7/RHEL7) 中相关的行:

$ grep /var/log/messages /etc/syslog.conf 
*.info;mail.none;news.none;authpriv.none;cron.none /var/log/messages

2.重启syslog service以生效上面的变化

#service syslog restart

在OL7或者RHEL7上,请使用如下的命令:

#/bin/systemctl restart rsyslog.service
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: