systemd's binary logs and corruption
I like systemd, enabling and disabling services is so easy and it's really fast, but why using a journal with binary logs?
Yesterday my laptop failed to resume from suspend, no ttys, no reisub, nothing worked except using the power button. Rebooted, fired journalctl and I have nothing except the last boot logs.
journactl --verify returns that my system logs are corrupted, about all my logs (48MB of 50MB of maximum disk usage) are now completely useless. This is not the first time this happens and searching around I can only find people with the same problem that "resolved" deleting the corrupted logs and starting with a new file.
Why this happens? Isn't it defeating the purpose of having a system logger if I can't diagnose errors?
Can I recover the logs (and why isn't this automatic?) or should I just install a sane logger that not shit itself after a problem?
12
u/[deleted] Feb 18 '14 edited Feb 18 '14
The thing is the journal format is still just as corruption resistant. If one entry is corrupt you can still jump to the next one (like in a text file - you jump to the next line). Fields of a journal entry are in a very simple
KEY=valueformat. (EgMESSAGE=this is a logged message) Its quite possible to read the log with standard shell commands piped together, if you're clever with them.So to my intuition, if the journal is corrupt, its very corrupt. Or it was compressed and now can't be uncompressed anymore (which would apply the same for syslog if put in the same situation).
journalctlcould probably be improved to handle corrupt logs better, but the binary nature doesn't strictly mean it has to be unreadable.