在 CentOS 里,syslog 的“启动”位置和方式取决于系统版本以及你用的是哪种日志服务。
通常是:
syslogrsyslog(更常见)service rsyslog status
service rsyslog start
service rsyslog restart
或(旧一点的):
service syslog start
chkconfig rsyslog on
/etc/rsyslog.conf
/etc/sysconfig/rsyslog
CentOS 7+ 默认用 rsyslog(systemd 管理):
systemctl status rsyslog
systemctl start rsyslog
systemctl enable rsyslog
/usr/lib/systemd/system/rsyslog.service
CentOS 7 以后,系统日志核心在 systemd-journald:
systemctl status systemd-journald
查看日志:
journalctl
rsyslog 通常只是把 journal 的日志再写一份到
/var/log/messages
/var/log/messages # 系统日志(rsyslog)
/var/log/secure # 安全/登录日志
/var/log/cron # 定时任务
/run/log/journal/ # journald 日志
ps -ef | grep rsyslog
systemctl | grep -E "rsyslog|journald"
如果你能告诉我:
我可以直接给你最精确的命令。