vacuum systemd journal logs




On this morning ( 02:10 AM ) on my server send alert that was disk usage was critical. We realize that size of folder /var/log/journal/ was not normal. The logs can start to add more and take considerable amount of disk space.



# du -h  /var/log/journal/
1.2 G  /var/log/journal/

1.2 GB was worth of journal files, with the oldest dating back around 2 months.

Systemd it self got command to clear them. And because i don't need that many logs, so we can clear them out. There are generally 2 ways to do this :
1. Clear systemd journals if they exceed X storage
  # journalctl --vacuum-size=2G


2. Clear systemd journals older than X days
  # journalctl --vacuum-time=10d


which i choose the second options :



Now , /var/log/journal/ should be smaller.

No comments:

Post a Comment