Manjaro Limit the size of .log files & the journal

Limit the size of .log files & the journal

From Manjaro
Revision as of 04:38, 13 August 2013 by imported>Handy (Created page with "= Introduction = Few users who run distros on their desktop, Notebook, Netbook... machines, need to keep huge log files that go back for many months or even years, on their s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

Few users who run distros on their desktop, Notebook, Netbook... machines, need to keep huge log files that go back for many months or even years, on their system, it is a waste of space & also makes viewing your log files slower than need be.

The systemd journal has taken the place of log files though it has an option for the standard type log files to be created & maintained in the usual fashion, which is the way that Manjaro is set to use.


The journal & the logs duplicate the same information

You can read the text of the log files in a text editor, or using the cat, more, less & such commands as you would on any other text file. The journal on the other hand requires the journalctl command to be able to access its contents. The following is a good way to read the journal:

sudo journalctl | more


How to set a maximum size limit for the journal

You need to use your text editor with root priviliges, starting it with sudo will do the job.

With a simple edit of the /etc/systemd/journald.conf you can set the maximum size limit of the /var/log/journal .

  • Uncomment the following line & add the size limit that you want. I set mine to 50MB like this:
SystemMaxUse=50M

After a reboot, you should find that your journal is now somewhat less than 50MB (or whatever limit you set), as it needs to have some working space. Mine went to 38M from 391M.

See the troubleshooting section if the above did not work for you.


How to set maximum log file size

This is as simple as the previous example for the journal, this time the file we edit (with root priviliges also) is /etc/logrotate.conf .

You'll find these two lines (without the 10M which is the current limit that I have set on my machine):

#restrict maximum size of log files
size 10M


Troubleshooting

The above commands don't work for everyone, there are a few workarounds that work for some users I'll post some of them in the future. Some are in the forum topic on this subject, see below.



Support

Following is a link to this page's forum counterpart where you can post any related feedback: [1]

Cookies help us deliver our services. By using our services, you agree to our use of cookies.