温馨提示×

ubuntu syslog怎样重启

小樊
64
2026-09-11 00:26:32
栏目: 智能运维

在 Ubuntu 中,syslog 服务通常由 rsyslog 提供(较新版本默认)。重启方式如下:

1. 使用 systemctl(推荐,Ubuntu 16.04+)

sudo systemctl restart rsyslog

查看状态:

sudo systemctl status rsyslog

开机自启(如未启用):

sudo systemctl enable rsyslog

2. 使用 service 命令(兼容旧版本)

sudo service rsyslog restart

3. 如果你用的是 syslog-ng(少数情况)

sudo systemctl restart syslog-ng

或

sudo service syslog-ng restart

4. 确认当前用的是哪种 syslog

ps aux | grep syslog

或

systemctl list-units --type=service | grep log

补充说明

  • Ubuntu 20.04 / 22.04 / 24.04 默认是 rsyslog
  • 日志文件一般在:
    • /var/log/syslog
    • /var/log/messages

如果你是在 容器 / 最小化系统 里没有 systemd,告诉我环境,我可以给你对应方案。

0 踩