You are not logged in.

#1 2013-11-04 17:12:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

[solved] systemd's journal size

It's not a big deal, I'm just curious what's going on. I did what the wiki says https://wiki.archlinux.org/index.php/Sy … size_limit , but I have my doubts whether it works:

$ grep -v "#" /etc/systemd/journald.conf
[Journal]
SystemMaxUse=50M
SystemMaxFileSize=10M
$ du -sh /var/log/journal
55M	/var/log/journal
$ journalctl --disk-usage
Journals take up 3.4M on disk.

How did 'journalctl --disk-usage' come up with 3.4 MB?

http://cgit.freedesktop.org/systemd/systemd/plain/TODO says

journald: we currently rotate only after MaxUse+MaxFilesize has been reached.

Does it mean it won't grow bigger than 50+10 MB?

man journald.conf wrote:

journalctl and systemd-journald ignore all files with names not ending with ".journal" or ".journal~", so only such files, located in the appropriate directories, are taken into account when calculating current disk usage.

journal files is all I got there:

$ find /var/log/journal/0dcc5d71ea3c9513b2b3b6e24aac1fee -type f -not -name "*.journal" -not -name "*.journal~"
$

Last edited by karol (2013-11-15 20:17:58)

Offline

#2 2013-11-04 19:47:55

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,276

Re: [solved] systemd's journal size

In my case I also use

RuntimeMaxUse=50M

However my file sizes do seem approximately in step with what is expected from du -sh

$ sudo journalctl --disk-usage
Journals take up 768.0K on disk.
$ du -sh /var/log/journal
780K    /var/log/journal

Mind you I recently removed the journal directory to clean out coredumps by stopping the systemd-journald service and then doing the following before rebooting

# rm -fr /var/log/journal
# mkdir /var/log/journal

The files look sensible since doing that.  I have had the journal files corrupted at various times when there has been a system hang and this is easily seen if the journal is verified with

# journalctl --verify

Unless the above shows pass on all files I remove the journal directory entirely to clean it up as I believe that systemd can't clean up corrupted binary journal files.

Maybe the journal disk usage excludes things like coredumps?

Last edited by mcloaked (2013-11-04 19:50:43)


Mike C

Offline

#3 2013-11-04 19:56:41

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] systemd's journal size

@mcloaked, your setting in journald.conf has nothing to do with how much space the journal takes on disk.  Please read journald.conf(5).


Edit: As far as what you are experiencing karol, I have no idea.  I recently reinstalled my system to clean things up a bit.  My install was from when I was a new Arch user, and didn't have as good of an understanding about the filesystem.  So I figured a cleanup was in order.

But here is what I have:

% grep -v "#" /etc/systemd/journald.conf
[Journal]
Storage=persistent
SystemMaxUse=400M
SystemMaxFileSize=30M
RuntimeMaxUse=250M
RuntimeMaxFileSize=30M

and

% du -sh /var/log/journal
45M	/var/log/journal

and

% journalctl --disk-usage
Journals take up 44.4M on disk.

So mine seems right... sorry I can't be of more help.

Last edited by WonderWoofy (2013-11-04 20:01:26)

Offline

#4 2013-11-04 20:41:49

Kilzool
Member
From: Ireland
Registered: 2010-08-04
Posts: 232

Re: [solved] systemd's journal size

Karol, I created systemd unit, that executes on shutdown, which clears out the corrupted binary (?) files in /var/log/journal.

And ever since, journalctl is reporting the correct disk usage.

$ grep -v "#" /etc/systemd/journald.conf

[Journal]
SystemMaxUse=50M
SystemMaxFileSize=10M
$ du -sh /var/log/journal
6.6M    /var/log/journal

Last edited by Kilzool (2013-11-04 20:44:52)

Offline

#5 2013-11-04 20:53:48

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] systemd's journal size

I'll wait to see if the logs will stay at < 60 MB.
I've already did a 'rm -f'-style cleanup a couple months ago.

Offline

#6 2013-11-06 01:19:15

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: [solved] systemd's journal size

Either I'm no longer getting corruption or systemd is now cleaning up after itself as I haven't needed to manually delete corrupt files for a while. Did they fix something? Or have I just been lucky?

My sizes are also similar from du and --disk-usage, both being significantly under the limits set in the config. (So I'm no help either.)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#7 2013-11-08 05:46:10

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] systemd's journal size

cfr wrote:

So I'm no help either.

You guys suck ;-)

And I'm an idiot:

$ du -sh /var/log/journal
55M	/var/log/journal
$ journalctl --disk-usage
Journals take up 3.4M on disk.
$ sudo journalctl --disk-usage
Journals take up 54.3M on disk.

I'll leave the thread open to see if the logs grow to more than 60 MB.

Offline

#8 2013-11-08 09:55:36

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,276

Re: [solved] systemd's journal size

Thanks for that Karol - it is a useful distinction running the command as user and root.  I don't think you are an idiot at all, and easy to not realise that the command running as user will not give the full file set.  Of course with hindsight it is obvious!


Mike C

Offline

#9 2013-11-08 10:20:45

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] systemd's journal size

@karol

Can you really run the du command as a normal user? For me it does not work without sudo:

~ $ du -sh /var/log/journal
du: warning: summarizing conflicts with --max-depth=1
Try 'du --help' for more information.

Offline

#10 2013-11-08 10:24:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] systemd's journal size

Aren't you using some kind of alias for 'du'?
What's the output of 'type -p du'?

Offline

#11 2013-11-08 10:27:21

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] systemd's journal size

*Stupid*. Somewhere deep in my bashrc I found indeed this alias:

alias du='du --max-depth=1 -h'

Sorry for that and thanks for the comment.

Offline

#12 2013-11-15 20:17:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] systemd's journal size

I haven't removed anything manually, but the size went down a bit:

$ du -sh /var/log/journal/
53M	/var/log/journal/
$ journalctl --disk-usage
Journals take up 3.0M on disk.
$ sudo journalctl --disk-usage
Journals take up 52.9M on disk.

Seems that the journal size won't exceed MaxUse+MaxFilesize.


Marking the thread as solved.

Offline

#13 2014-03-20 20:30:50

theking2
Banned
From: Romanshorn Switzerland
Registered: 2009-03-04
Posts: 372

Re: [solved] systemd's journal size

$ sudo journalctl --disk-usage
Journals take up 16.0M on disk.
$ cat /etc/systemd/journald.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# See journald.conf(5) for details

[Journal]
Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=login
#RateLimitInterval=10s
#RateLimitBurst=200
SystemMaxUse=10M
SystemMaxFileSize=1M
MaxRetentionSec=100 day
MaxFileSec=1 week
ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info

Last edited by theking2 (2014-03-20 20:31:55)


archlinux on a Gigabyte C1037UN-EU, 16GiB
a Promise  PDC40718 based ZFS set
root on a Samsung SSD PB22-J
running LogitechMediaServer(-git), Samba, MiniDLNA, TOR

Offline

#14 2014-03-20 20:33:42

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [solved] systemd's journal size

theking2 Please don't bump and crosspost: this thread is solved and you have dumped the same post in a similar thread.


Cllosing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB