centos 重启日志服务

因为/var/log/message日志太多了,遂手贱删掉了这个文件,新建messages,发现没有日志写入

 

正确清空日志的方法

cat /dev/null > /var/log/boot.log
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/cron
cat /dev/null > /var/log/dmesg
cat /dev/null > /var/log/firewalld
cat /dev/null > /var/log/grubby
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/mail.info
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/spooler
cat /dev/null > /var/log/syslog
cat /dev/null > /var/log/tallylog
cat /dev/null > /var/log/wpa_supplicant.log
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/yum.log

 

日志写不进message,只能重启日志服务咯

rm /var/log/message
systemctl restart rsyslog

 

 

参考

centos7的syslog知识点

posted @ 2018-08-23 15:11  吃饭睡觉打逗逗  阅读(4468)  评论(0编辑  收藏  举报