Check Journalctl Log size and archive/delete old logs.
In this article, we will look how to check the journalctl log size on our system and how to archive/delete old log files.
1. Check current disk space usage by journal
[root@ngelinux9 ~]# journalctl --disk-usage Archived and active journals take up 4.0M on disk.
2. Delete any old journals after saving 10MB of logs.
[root@ngelinux9 ~]# journalctl --vacuum-size=10M Vacuuming done, freed 0B of archived journals on disk. [root@ngelinux9 ~]#
3. Another way is to delete log files older than, say 1 month.
[root@ngelinux9 ~]# journalctl --vacuum-time=1month Vacuuming done, freed 0B of archived journals on disk. [root@ngelinux9 ~]#
Using above ways, we can do the housekeeping va commands.
However to configure it on server, we have few options to limit the log size.
4. Limiting the journal usage using below 4 options.
### Limits maximum disk space that can be used by Journal #SystemMaxUse= ### Amount of space to keep free on the partition #SystemKeepFree= ### Maximum individual journal file size limit before it gets rotated #SystemMaxFileSize= ### Max disk space that can be used in /run filesystem #RuntimeMaxUse= ### Amount of space to keep free on /run filesystem #RuntimeKeepFree= ### Maximum individual journal file size limit on /run Filesystem #RuntimeMaxFileSize=