log文件位置(archlinux)
/var/log/journal
log文件默认会一直增长,直到达到磁盘容量的10%
在使用gnome的disk usage analysis这个软件对磁盘进行分析时发现log的文件竟然有3G所以想怎么把这些日志清理掉以及如何设定一个大小,超过设定时自动清理
修改journal的配置文件
wiki上说这个journal是systemd自带的log系统,果然systemd挺不错的
systemd has its own logging system called the journal; therefore, running a syslog daemon is no longer required. To read the log
修改配置文件
sudo vim /etc/systemd/journald.conf
设定限制大小为50M

去掉不需要的日志
删除日志记录为一周之前的文件
sudo journalctl --vacuum-time=1weeks
对比磁盘log文件清理的变化
清理前:
查看磁盘容量

查看log文件大小:

清理之后:


网友评论