A couple of special cases deserve separate mention. These two are not read
using standard methods, but each has its own program for reading from the
command line. The commands are the same as the log names:
faillog—Reads from /var/log/faillog and lists recent login
failures
lastlog—Reads from /var/log/lastlog and lists the most recent
login for each account
For those who love GUI applications, there is a log reader installed by default
in Ubuntu. Find System Log in the Dash to run it. It does not include every
log in /var/log, but it does include the most important ones that serve the
widest audience.
Rotating Log Files
Log files are great, but sometimes they can get unwieldy as time passes and
more information is logged. Rotating log files prevents that problem. Rotating
a log file means archiving the current log file, starting a fresh log, and
deleting older log files. This means you always have a current log file to
peruse (the previous log file), and the log files never grow too large.
Typically, log rotation is set up by an administrator to happen nightly, at a
time when the system is not being heavily used. This is done with a utility
called logrotate running as a cron job. (cron is described in Chapter
14 , “Automating Tasks and Shell Scripting.”)
Ubuntu comes with logrotate installed. There is a cron job already set
as well. You can find the script at /etc/cron.daily/logrotate. This
file is a bash script and looks like this:
Click here to view code image
#!/bin/sh
# Clean nonexistent log file entries from status filecd
/var/lib/logrotatetest -e
status || touch statushead -1 status > status.cleansed 's/"//g'
status | while read
logfile datedo [ -e "$logfile" ] && echo "\"$logfile\" $date"done
>> status.cleanmv
status.clean status
test -x /usr/sbin/logrotate || exit 0/usr/sbin/logrotate
/etc/logrotate.conf
Don’t worry if you don’t yet understand everything in this script. You don’t