TransWikia.com

SystemD-JournalD Loses Track of Previous Boot Persistent Log Data

Unix & Linux Asked by PhilBot on December 12, 2021

I am running SystemD JournalD version 244.3 on a custom Embedded Linux board.

root@board:/var/log/journal# journalctl --version
systemd 244 (244.3+)
-PAM -AUDIT -SELINUX +IMA -APPARMOR -SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid

My /etc/systemd/journald.conf file is configured to save persistent logs:

root@board:/var/log/journal# cat /etc/systemd/journald.conf 
[Journal]
Storage=persistent
SystemMaxFileSize=10M
SystemMaxFiles=6
SystemMaxUse=64M
SystemKeepFree=64M
SyncIntervalSec=60
RateLimitBurst=0
RateLimitInterval=0s
ForwardToSyslog=no

I can see that JournalD has persistently saved previous boots under /var/log/jounal:

root@board:/var/log/journal# ls -rlt
total 8
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 17:40 ffc9c0e961a74d3b8d19a6f32a5f62ce
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 17:40 10fab8e697104bfeb2f769b11cf42473
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 17:40 c9b5b0b8d10a48f68bda02db47bd3998
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 20:36 0cdee57054ba49a3a75ee9f21d5afbce
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 20:47 7b38f3dd12484f9f82e1d9fc686bc3fe
drwxr-sr-x 2 root systemd-journal 1024 Jul 22 22:58 3315ac28810449538f2637d56d3ff707
drwxr-sr-x 2 root systemd-journal 1024 Jul 23 13:56 d9fb69f615b04b69998bd5dc70af7b0f
drwxr-sr-x 2 root systemd-journal 1024 Jul 23 14:29 46e633c0af784239b02f8d230125ee9b

In order to view these logs, I have to explicitely use the "-D" flag of journalctl:

journalctl -D /var/log/journal -m 

And to view the newest first, throw the "-r" flag in there

journalctl -D /var/log/journal -m -r

The problem I see is that journalctl does not seem to know about these previous boots without pointing it to the directory with "-D"!

root@board:/var/log/journal# journalctl --list-boots
0 7da269c106be4979bd54bf1f06e6106a Thu 2020-07-23 14:29:50 UTC—Thu 2020-07-23
 14:53:51 UTC

There is only 1 boot listed – the others are ignored.

Also, journalctl does not have an accounting of the disk space used by the previous boots. It only tracks the current boot.

root@board:/var/log/journal# journalctl --disk-usage
Archived and active journals take up 8.0M in the file system.

This is the biggest problem, because the daemon itself does not cleanup previous boot data as it seems to have lost track of it.

How can I make JournalD consider previous boot data for log rotation and viewing of boots with "–list-boots". Thank you.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP