[systemd-devel] [Feature request] Retentiontime per unit configuration

Lennart Poettering lennart at poettering.net
Wed Oct 22 16:09:25 PDT 2014


On Wed, 27.08.14 08:39, Kris Erik Schwerdt (Schwerdt at itsc.uni-luebeck.de) wrote:

> Hallo 
> 
> During a task of migration of multiple servers to a systemd-based
> distribution I was wondering if there would be a way of setting the
> retentiontime of journald per unit.
> In some cases e.g. there are limits for special program e.g. webserver
> where it is not allowed to keep the logs as long as the syslog. So it would
> be nice to have such a feature to avoid as much as possible plain-logfiles.

The retention logic is currently implemented per-journal. As soon as
the retention time is reached we rotate the whole journal away, and
rotate.

To allow per-service retention times would mean we'd either have to
split up the journal files per-service from the beginning (which would
suck perfomance-wise while viewing), or we'd have to "repack" the
files during rotate/vacuuming (which would suck perfomance-wise while
roating/vacuuming). The latter sounds slightly better for this. 

In the past, we got requests to allow different retention times for
the various log priorities. I figure if we implement that we can also
implement per-service retention times at the same time, using the same
logic. 

That all said, I am not entirely sure what a natural way to configure
the retention time could be and (assuming that we'd want to configure
this in .service files) how we'd pass this nicely to journald to
enforce.

Anyway, for now I added this to the TODO list, so that it is not
forgotten.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list