[systemd-devel] Force rotating the journal?

Dave Reisner d at falconindy.com
Wed Nov 28 07:14:14 PST 2012


On Wed, Nov 28, 2012 at 01:35:24PM +0200, Apostolos Bartziokas wrote:
> On 11/28/2012 01:29 PM, Kay Sievers wrote:
> >On Wed, Nov 28, 2012 at 12:10 PM, Apostolos Bartziokas
> ><barz621 at gmail.com> wrote:
> >>The journal on my system doesn't respect the SystemMaxUse parameter in
> >>/etc/systemd/journald.conf. I set in 30M and it has grown to 70M.
> >>
> >>The solution i found is to manually delete the journal folder but this is a
> >>somehow "brute force" solution and i don't like it. So is there a more
> >>"elegant" way of doing this?
> >>
> >>Sorry for the simple question on this list and thanks in advance.
> >Try sending it a signal:
> >   http://www.freedesktop.org/software/systemd/man/systemd-journald.service
> >
> >Also note, that older versions of the journal did not always handle
> >rotation correctly. Depends on the distribution how many fixes they
> >backport.
> >
> >Kay
> >
> Hello
> 
> I am on v196 and i think the rotation worked fine until 194 but i
> cannot be completely sure.
> 
> Thanks again.
> 

(mangling message, please don't top post)

I'm not sure when it happened, but rotation used to be "off" by a
difference of whatever the MaxFileSize option was, e.g. if you had a
200M MaxUse and a 50M MaxFileSize, then you'd see usage up to 250M
before old logs were expired. I reported this, and there was a TODO item
added.

At least with 196 (maybe earlier), this no longer holds true any more.
The journal appears to just ignore settings in journald.conf and grow
without bound:

$ grep -E 'SystemMax(Use|FileSize)' /etc/systemd/journald.conf
SystemMaxUse=200M
SystemMaxFileSize=50M

$ journalctl --disk-usage
Journals take up 436.0M on disk.

Forcing rotation opens a new file, but old logs are not expired, leaving
disk usage way above the set maximum. There also seems to be a recent
issue with more uncleanly closed journal files showing up. Unless I
umount my root at shutdown (with initramfs magic), I can very reliably
expect that the journal will mark the last used file as unclean on the
next bootup. My suspicion is that the journal doesn't take into account
these uncleanly closed files when calculating disk usage for rotation,
but I've not had time to confirm that.

Cheers,
Dave


More information about the systemd-devel mailing list