messages,CentOS 7不收集日志或不存在 /var/log/messages

/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)这段的

相关推荐
SEO_juper11 小时前
不同国家服务器、域名选择,提升本地谷歌抓取优先级
运维·服务器·seo·外贸·geo·独立站·跨境电商独立站
DeboPXK11 小时前
NSK VH25EM 高防尘法兰型导轨技术手册
服务器·网络·数据库·经验分享·规格说明书
浮云中的神马-潘帅11 小时前
魔兽世界自动化打地鼠方案
运维·自动化
鼎讯信通11 小时前
1024J冲击能量+三种放电模式:DLG-1高压发生器覆盖电缆故障全场景
运维·能源·信息与通信
图灵追慕者11 小时前
Nginx安裝以及配置顯示本地服務器文件夾
运维·nginx
超级赛博搬砖工11 小时前
SEO代理解析:成功搜索引擎抓取你需要了解的事项
大数据·运维·服务器·网络
换个昵称都难11 小时前
webrtc peerconnection_server 模块介绍
运维·服务器·webrtc
志栋智能12 小时前
超自动化安全的技术选型与架构设计指南
运维·安全·自动化
isyangli_blog12 小时前
SDN 基本应用实践 —— 使用命令行实现简易防火墙功能实验报告
服务器·php·apache
ai_coder_ai12 小时前
在自动化脚本中操作excel文件
运维·自动化·excel