1

There a log entries on my CentOS 7.4 server in /run/log/journal/ that are up to 1.3GB. IS it safe to clear the older files out?

[root@fbds journal]# pwd
/run/log/journal
[root@fbds journal]# ll
total 0
drwxr-s---+ 2 root systemd-journal 300 Feb  7 01:20 b21f6bf11d444f17929cc92e62c594fe
[root@fbds journal]# cd b21f6bf11d444f17929cc92e62c594fe/
# ll
total 1318912
-rwxr-x---+ 1 root systemd-journal  41943040 Dec 30 21:01 system@81114d71ac9543ed872f3aac55422f37-0000000000000001-00055f34f963cdf8.journal
-rw-r-----+ 1 root systemd-journal 109051904 Jan 13 06:15 system@81114d71ac9543ed872f3aac55422f37-00000000000089d6-000561995cfdc85e.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 09:34 system@81114d71ac9543ed872f3aac55422f37-00000000000215cc-000562a67f51f6f5.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 11:59 system@81114d71ac9543ed872f3aac55422f37-000000000003db42-000562a94649a794.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 13:58 system@81114d71ac9543ed872f3aac55422f37-000000000005a089-000562ab4ebd20da.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 15:42 system@81114d71ac9543ed872f3aac55422f37-000000000007658f-000562acf5dec09e.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 17:16 system@81114d71ac9543ed872f3aac55422f37-0000000000092a75-000562ae6a598b05.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 13 18:42 system@81114d71ac9543ed872f3aac55422f37-00000000000aef3b-000562afba852642.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 16 23:32 system@81114d71ac9543ed872f3aac55422f37-00000000000cb3e7-000562b0ef720667.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 17 09:49 system@81114d71ac9543ed872f3aac55422f37-00000000000e6786-000562f15719ce89.journal
-rw-r-----+ 1 root systemd-journal 117440512 Jan 17 12:54 system@81114d71ac9543ed872f3aac55422f37-00000000001027f3-000562f9f3f2ec83.journal
-rw-r-----+ 1 root systemd-journal 100663296 Feb  7 01:20 system@81114d71ac9543ed872f3aac55422f37-000000000011ebbc-000562fc8877b1cd.journal
-rw-r-----+ 1 root systemd-journal  41943040 Feb 28 11:20 system.journal
Kusalananda
  • 333,661
mav1c
  • 11

1 Answers1

3

It is safe, as long as you do it correctly. That is, after all, what eventually happens to those files. However, you can end up with holes in your journal if you do not do it correctly, and journalctl's behaviour in the face of a journal with holes in has not always been good, and even when it is good it can sometimes be surprising.

The right way to address this is by telling systemd-journald (which is what is writing these files) to employ a lower maximum total size. This is done with settings in the journald.conf group of settings files.

You can, if you like, also tell systemd-journald to place the journal in /var/log/journal rather than in /run/log/journal, with other journald.conf settings.

Further reading

JdeBP
  • 68,745