在 Debian(及大多数 Linux 系统)中,“噪声日志”通常指某些服务或内核频繁打印、但你并不关心、甚至刷屏的日志(如网卡 up/down、蓝牙、cron、systemd 等)。
下面按常用程度给你几种屏蔽方法。
Debian 默认用 systemd-journald 收集日志。
编辑:
sudo nano /etc/systemd/journald.conf
修改或添加:
MaxLevelStore=warning
MaxLevelSyslog=warning
含义:
debug / info 不再存盘warning / err / crit 保留重启:
sudo systemctl restart systemd-journald
例如屏蔽 bluetooth:
sudo systemctl edit bluetooth.service
写入:
[Service]
LogLevelMax=err
生效:
sudo systemctl daemon-reload
sudo systemctl restart bluetooth.service
✅ 以后 bluetooth 的 info/debug 都不会进 journal
如果你用的是 rsyslog:
编辑:
sudo nano /etc/rsyslog.conf
:programname, isequal, "cron" stop
:msg, contains, "eth0" stop
重启:
sudo systemctl restart rsyslog
sudo dmesg -n 3
只显示 error 以上
sudo nano /etc/sysctl.d/99-quiet.conf
kernel.printk = 3 3 3 3
sudo systemctl edit systemd-logind.service
[Service]
LogLevelMax=err
sudo nano /etc/systemd/journald.conf
Storage=none
⚠️ 会失去所有日志,不推荐服务器
journalctl -p err
journalctl -u 服务名
journalctl -f
✅ journald.conf 限制级别
✅ 对具体服务用 LogLevelMax
✅ 内核用 printk
如果你愿意,可以:
我可以给你精准屏蔽规则。