[systemd-devel] Delete stale *.journal-files from containers
Lennart Poettering
lennart at poettering.net
Mon Nov 2 00:09:39 PST 2015
On Wed, 28.10.15 14:39, Peter Paule (systemd-devel at fedux.org) wrote:
>
> Hi,
>
> I use `docker` to run containers. Each container uses `systemd` as PID 1. I
> pass `-v /var/log/journal:/var/log/journal` to `docker run` to accumulate
> journals on the docker host. Every time a container is started, a new
> journal file is generated based on the machine-id, leaving quite a few
> 8MiB-`system.journal`-files on the system after the container was "stopped".
>
> Example:
>
> ~~~
> docker run --name centos-1 --rm -ti -v /sys/fs/cgroup:/sys/fs/cgroup -v
> /var/log/journal:/var/log/journal feduxorg/centos
> ~~~
>
> Is there way beside `find /var/log/journal -time +30 -delete` to get rid of
> stale old `journal`.files? I tried `MaxRetentionSec=1day` and
> `MaxTimeSec=1day`, but none of this made `systemd-journald` to delete the
> `system.journal`-files.
Normally, if a system gets shutdown correctly the existing journal
file should be reused on the next startup again. A new file is only
created if the system wasn't shut down correctly and the old file is
found to be in a "dirty" state.
That said, if the machine ID changes on each boot a new directory will
be created too.
The main "system.journal" file is where systemd writes its stuff to,
so it is obviously not removed by vacuuming.
Also note that "journalctl --vacuum-size=", "journalctl
--vacuum-files=", journalctl --vacuum-time=" may be used to vacuum the
files out-of-band.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list