Difference between revisions of "Limit the size of .log files & the journal"

imported>Handy
imported>Handy
(One intermediate revision by the same user not shown)
Line 45: Line 45:
== 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
  Note: Following are few pointers on things
of the journalctl command, so you don't need to use sudo
you can do to make using journalctl quicker,
(swap "handy" for your username):
easier & more effective, on your system.
 
==You don't have to use sudo with journalctl==
 
Add your '''user''' to '''adm''' group. This gives your <user> full use of the '''journalctl''' command. No more need to use sudo.
Swap "handy" for your username in the following:
   
   
  # usermod -a -G adm handy
  # 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:
==See the whole line of the journalctl output text==
 
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
  $ journalctl -b -p err|less
   
   
This gives you a means of avoiding the truncation of output
Doing so, gives you a means of avoiding the truncation of output which some system displays configurations may experience.
which some system' displays may experience.
 
===Use a ~/.bashrc alias to make this easy===
I use a ~/.bashrc alias to make this easy:
 
I use the following ~/.bashrc alias:
   
   
  alias errors="journalctl -b -p err|less"
  alias errors="journalctl -b -p err|less"
   
   
When I type "errors" in the Terminal, all errors or worse,
On entering '''errors''' in the Terminal, all errors or worse since the last boot are sent to (piped) to the Terminal based text display tool called '''Less''' which wraps the text output of the journalctl command. Apart from anything else, it makes the errors more useful for anyone reading them in the forum!
since the last boot are displayed in the Terminal text  
 
display tool "Less" & no lines are truncated.  
Type '''Q''' (upper or lower case) to close "Less".
Type Q to close "less".




Anonymous user