From 582422d5f0ab93c07955549d7af7facb5a55e1c9 Mon Sep 17 00:00:00 2001 From: iProbe Date: Tue, 13 Dec 2022 10:16:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'linux=E5=9F=BA=E7=A1=80/?= =?UTF-8?q?=E6=B8=85=E7=90=86journal=E6=97=A5=E5=BF=97.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux基础/清理journal日志.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 linux基础/清理journal日志.md diff --git a/linux基础/清理journal日志.md b/linux基础/清理journal日志.md new file mode 100644 index 0000000..e3a9638 --- /dev/null +++ b/linux基础/清理journal日志.md @@ -0,0 +1,15 @@ +## 临时清理 +```bash +> /var/log/journal/xxx/system.journal +``` +## 自动维护 +```bash +# 保留近1周日志 +journalctl --vacuum-time=1w +# 保留500M日志 +journalctl --vacuum-size=500M +``` +注意: 若提示Error was encountered while opening journal files: Input/output error,则表明文件损坏,删除日志,并重启 +```bash +systemctl restart systemd-journald.service +``` \ No newline at end of file