Free disk space taken by log files
Posted: 29 Sep 2014, 19:02
Linux with systemd, logs just about everything - and it will grow a lot as time goes by.
Just type to see what you have logged.
On servers that may be good but much of that is not necessary on a Desktop - at least not so much of it.
But don't get me wrong: journalctl is a great tool to find what is going on; you can type to list only errors and lots more.
As I said I do not need so much of it.
I checked how much systemd was logging on my disk with:
And received a shock when it came up with several gigabytes.
Then I edited /etc/systemd/journald.conf
And set a maximum size for the log:
It only needed to be uncommented and me providing a value of 100M.
I also set this:
That should do it! But after a reboot I still had a load of old entries so it was time for some berserk style:
I stopped the journalservice
And here is the Berserk bit; I removed the journal directory with (a s...load of) contents
...
Less brave non Berserks (chickens) may consider moving the journal:
...
Then I re-created an empty journal in /var/log
Time to start the logging enchilada again then:
Now the
showed 0 zero, and after a reboot the data started to flow again.
7G saved and now the data will not exceed approximately 100M (if systemd needs more space to log an ongoing operation in a file, it will take the extra space the file needs).
If I will miss those boot messages from february 2013?
Nope - not at all.
Just type
Code: Select all
journalctlOn servers that may be good but much of that is not necessary on a Desktop - at least not so much of it.
But don't get me wrong: journalctl is a great tool to find what is going on; you can type
Code: Select all
journalctl -b -p errAs I said I do not need so much of it.
I checked how much systemd was logging on my disk with:
Code: Select all
journalctl --disk-usageAnd received a shock when it came up with several gigabytes.
Then I edited /etc/systemd/journald.conf
And set a maximum size for the log:
Code: Select all
SystemMaxUse=100M
It only needed to be uncommented and me providing a value of 100M.
I also set this:
Code: Select all
SystemMaxFileSize=10MThat should do it! But after a reboot I still had a load of old entries so it was time for some berserk style:
I stopped the journalservice
Code: Select all
systemctl stop systemd-journald.serviceAnd here is the Berserk bit; I removed the journal directory with (a s...load of) contents

Code: Select all
cd /var/logCode: Select all
rm -r journal...
Less brave non Berserks (chickens) may consider moving the journal:
Code: Select all
mv journal journal_backup...
Then I re-created an empty journal in /var/log
Code: Select all
mkdir journalTime to start the logging enchilada again then:
Code: Select all
systemctl start systemd-journald.serviceNow the
Code: Select all
journalctl --disk-usage 7G saved and now the data will not exceed approximately 100M (if systemd needs more space to log an ongoing operation in a file, it will take the extra space the file needs).
If I will miss those boot messages from february 2013?
Nope - not at all.