Delete systemd journal logs


Today on one of my server I saw that the disk space in /var is low, and the reason for that was in /var/log/journal.

In this post I will share how to delete systemd journal logs right, and how to make our server to do this alone.

root@mp-web06:/var/log# du -sh * |grep G
4.1G journal

Delete systemd journal logs older than X days

root@mp-web06:/var/log# journalctl --vacuum-time=5d
Deleted archived journal /var/log/journal/a20c526fbd1ffe2fe0fc6d5056053509/user-1003@55bfa9c91d5944b3a7a133fcec536fb8-000000000042a6ee-00057dd636182198.journal (8.0M).
Vacuuming done, freed 3.8G of archived journals from /var/log/journal/a20c526fbd1ffe2fe0fc6d5056053509.

The idea here is the server will delete the logs older than 5 days.