从 systemctl status 中清除失败状态(或所有旧日志)?

从 systemctl status 中清除失败状态(或所有旧日志)?

尝试了不同的方法,但无法将这个旧的整体删除清除/。当我跑步时

systemctl status httpd.service

结果:

Mar 09 09:28:08 il systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 09 09:28:08 il systemd[1]: Failed to start The Apache HTTP Server.
Mar 09 09:28:08 il systemd[1]: Unit httpd.service entered failed state.
Mar 09 09:28:08 il systemd[1]: httpd.service failed.
Mar 09 19:27:59 il systemd[1]: Starting The Apache HTTP Server...
Mar 09 19:27:59 il systemd[1]: Started The Apache HTTP Server.

失败的状态显示为红色,我想清除所有旧的日志条目。

尝试过:

systemctl reset-failed 
systemctl reset-failed httpd.service

但它不断出现。

跑步CentOS Linux release 7.6.1810 (Core)

谢谢。

答案1

可以通过清除所有日志日志来完成:

sudo journalctl --rotate && sudo journalctl --vacuum-time=1s

或者:

sudo rm /var/log/journal/*/*.journal
sudo systemctl restart systemd-journald

相关内容