Difference between revisions of "Limit the size of .log files & the journal"
Views
Actions
Namespaces
Variants
Tools
Limit the size of .log files & the journal (view source)
Revision as of 00:20, 12 February 2014
, 10 years ago→The Journalctl command - a quick reference [http://www.freedesktop.org/software/systemd/man/journalctl.html]
imported>Handy |
imported>Handy |
||
(4 intermediate revisions by the same user not shown) | |||
Line 41: | Line 41: | ||
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. | 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. | ||
<br clear="all"/> | |||
== The Journalctl command - a quick reference [http://www.freedesktop.org/software/systemd/man/journalctl.html]== | == The Journalctl command - a quick reference [http://www.freedesktop.org/software/systemd/man/journalctl.html]== | ||
Note: Add user to adm group, gives <user> full use | |||
of the journalctl command, so you don't need to use sudo | |||
(swap "handy" for your username): | |||
# usermod -a -G adm handy | |||
Note2: You can pipe the output of journalctl to a file or | |||
to a text display tool like "More" or "Less", as follows: | |||
$ journalctl -b -p err|less | |||
This gives you a means of avoiding the truncation of output | |||
which some system' displays may experience. | |||
I use a ~/.bashrc alias to make this easy: | |||
alias errors="journalctl -b -p err|less" | |||
When I type "errors" in the Terminal, all errors or worse, | |||
since the last boot are displayed in the Terminal text | |||
display tool "Less" & no lines are truncated. | |||
Type Q to close "less". | |||
===== Access to full journal containing info from the system & users: ===== | ===== Access to full journal containing info from the system & users: ===== | ||
Line 67: | Line 86: | ||
$ journalctl -b -p err | $ journalctl -b -p err | ||
Following is the above command with its output sent to a file called '''-ERRORS''' in your ''/home/<user>'' directory. Having the '''-''' at the beginning of the name should cause the file to be shown at the top of the list of files when viewing the contents of your '''~/''' (''/home/<user>'') directory. This command makes it easy to copy the contents of the -ERRORS file, & then paste it to the forum. Doing so allows us to display ALL of the command's output instead of only being able to cut & paste the truncated lines from our terminal: | |||
$ Journalctl -b -p err > -ERRORS | |||
== Filtering based on time: == | == Filtering based on time: == | ||
Line 106: | Line 129: | ||
The Systemd Journal is capable of advanced functions beyond what has been mentioned here. The above is very good food for thought for people that are wondering if they need to be running '''syslog-ng''' or the like that creates most of the '''/var/log/*log''' files on their systems. | The Systemd Journal is capable of advanced functions beyond what has been mentioned here. The above is very good food for thought for people that are wondering if they need to be running '''syslog-ng''' or the like that creates most of the '''/var/log/*log''' files on their systems. | ||
By experimenting with the above commands one can make an informed decision for themselves, though as mentioned at the beginning of the Journal section, Arch & therefore Manjaro still run both the new systemd journal & the old style log file system in parallel. So if you find the /var/log/*log files to be redundant & you want to be rid of them, various methods would be effective. I'm | By experimenting with the above commands one can make an informed decision for themselves, though as mentioned at the beginning of the Journal section, Arch & therefore Manjaro still run both the new systemd journal & the old style log file system in parallel. So if you find the /var/log/*log files to be redundant & you want to be rid of them, various methods would be effective. | ||
Currently I'm running my system with syslog-ng (& its dependency) deleted. I deleted all of the log files from the /var/log directory (leaving any that are in their own sub-directories), except for Xorg.0.log , Xorg.0.old , lastlog , btmp & wtmp (pacman.log turned up when pacman was used). The deleted log files came back on reboot, but having since deleted them again they have stayed deleted for multiple reboots. | |||
= Managing /var/log/* files = | = Managing /var/log/* files = |