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

2023-06-15,,

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

翻译mos文章】Linux的/var/log/messages是空的(0k),messages.0, messages.1也是空的的相关教程结束。

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

下载本文的Word格式文档,以方便收藏与打印。