Mailinglist Archive: opensuse (389 mails)

< Previous Next >
Re: [opensuse] systemd logging - version 2
"Carlos E. R." <robin.listas@xxxxxxxxxxxxxx> wrote:
On 15/03/2019 13.33, Dave Howorth wrote:
Can systemd's journald be configured to write logs to RAM and then
periodically save them to disk?
Ok, found one (man journald.conf):

SyncIntervalSec=
The timeout before synchronizing journal files to disk.
After syncing, journal files are placed in the OFFLINE state. Note
that syncing is unconditionally done immediately after a
log message of priority CRIT, ALERT or EMERG has been logged. This
setting hence applies only to messages of the levels ERR,
WARNING, NOTICE, INFO, DEBUG. The default timeout is 5 minutes.

Hmm, so a supplementary question for extra points :)

I'm considering an environment where the 'hard disk' is an SD card (not
an SSD or HD) and so minimising writes to it is still a relevant goal.

It's possible to use journald to write all the logs to persistent
storage, which causes it to write to disk once every five minutes,
except in an emergency. That solves the problem but ...

Most applications still use separate log files under /var/log so the
strategy above requires every application to be customised to use
journald instead. That means customising lots of conf files in various
formats at best and ninja acrobatics at worst. Plus customising some of
the systemd unit files as well. And maintaining it all through updates.

So ... another approach is to mount a tmpfs in place of /var/log and
let the applications continue to log as normal. That works, but loses
all the logs on crash or power fail :( Not good. So there's at least
one solution out there - a thing called log2ram - that does a couple of
things. It regularly updates disk copies of RAM-based log files so
they're reasonably up-to-date after a reboot. And it copies the
directory structure under /var/log from RAM to disk whilst the system is
running and then copies the directory structure back from disk to RAM
when the system reboots. If we then treat journald as a special case
that writes to disk always so we benefit from its crash-saving feature,
then we have another solution.

So my question is whether this log2ram idea looks like it will hold
water? Or if there are other alternatives out there? (It seems like a
fairly common problem) Or any other thoughts from the deep-thinking
denizens here?

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups