linux清理并保留最近两天的日志
Contents
查询 systemd 日志占用空间
journalctl --disk-usage示例输出:
Archived and active journals take up 180.0M in the file system.设置日志最大空间和只保留最近两天日志(自动清理)
sudo nano /etc/systemd/journald.conf添加:
SystemMaxUse=200M
MaxRetentionSec=2day重启服务
sudo systemctl restart systemd-journald