[systemd-devel] [PATCH] journal: do server_vacuum for sigusr1

WaLyong Cho walyong.cho at samsung.com
Thu Aug 28 05:47:57 PDT 2014


On 08/28/2014 09:33 PM, WaLyong Cho wrote:
> runtime journal is migrated to system journal when only
> "/run/systemd/journal/flushed" exist. It's ok but according to this
> the system journal directory size(max use) can be over the config. If
> journal is not rotated during some time the journal directory can be
> remained as over the config(or default) size. To avoid, do
> server_vacuum just after the system journal migration from runtime.

If I add some of detail, you maybe think why this case could be happen.
Actually, it did. Assume every poweroff was not proceeded cleanly.
(Yeah, it is included in our terrible test case.) Then, journal backup
file(*.journal~) will be made on every startup time. These files will be
migrated to "/var/log/journal" by systemd-journal-flush.service unit.
(But not vacuumed.) That only be vacuumed when rotate is needed. But we
almost didn't have the chance because the system.journal is newly
created by backup. So if the journal file size is big then the vacuum
will be never happened. Finally, the "/var/log/journal" directory was
increased continuously.

Whatever the cause, I think server_vacuum should be done after the
journal file migration to make sure the size is NOT over-ed.

> ---
>  src/journal/journald-server.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
> index 01da38b..7e85892 100644
> --- a/src/journal/journald-server.c
> +++ b/src/journal/journald-server.c
> @@ -1224,6 +1224,7 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *
>          touch("/run/systemd/journal/flushed");
>          server_flush_to_var(s);
>          server_sync(s);
> +        server_vacuum(s);
>  
>          return 0;
>  }
> 


More information about the systemd-devel mailing list