![禁用 syslog 中有关 ntpd 的警告消息](https://linux22.com/image/1162174/%E7%A6%81%E7%94%A8%20syslog%20%E4%B8%AD%E6%9C%89%E5%85%B3%20ntpd%20%E7%9A%84%E8%AD%A6%E5%91%8A%E6%B6%88%E6%81%AF.png)
我启动计算机并禁用互联网,发现系统日志中充满了有关 ntpd 的警告消息
ntpd[1123]: error resolving pool 0.ubuntu.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[1123]: error resolving pool 1.ubuntu.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[1123]: error resolving pool 2.ubuntu.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[1123]: error resolving pool 3.ubuntu.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[1123]: error resolving pool ntp.ubuntu.com: Temporary failure in name resolution (-3)
我如何在系统日志中禁用这些警告?
答案1
我尝试在 ntpd 配置文件(/etc/ntp.conf)中添加以下内容:
logconfig = -clockall -peerall -sysall -syncall
根据手册,它应该阻止所有日志记录,但我仍然看到系统日志中出现“错误解决”消息。
我设法停止消息的唯一方法是使用 -l 选项启动 ntpd,并将日志文件输出发送到 /dev/null:
ntpd -l /dev/null