47 Ronin Multimedia

Excellence in Execution: Design, Code, and Web Media
Ads

Split multiple log files and monitor them with GNU tail

This may not be the most elegant way to monitor your system logs but at least you won’t need to run multiple shells. Using the GNU version of the tail command, you can view more than one log file on the screen and keep them updated in real time without interaction. Other versions of tail can only display one log at a time.

sudo tail -f /var/log/{cron,yum.log}
Password:
==> /var/log/cron < ==
Oct  3 12:48:01 titan crond[9309]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:49:01 titan crond[9366]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:50:01 titan crond[9406]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:50:01 titan crond[9409]: (root) CMD (/etc/webmin/quota/email.pl)
Oct  3 12:50:01 titan crond[9410]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
Oct  3 12:50:01 titan crond[9411]: (root) CMD (/usr/lib/sa/sa1 1 1)
Oct  3 12:51:01 titan crond[9469]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:52:01 titan crond[9522]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:53:02 titan crond[9572]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)
Oct  3 12:54:01 titan crond[9611]: (root) CMD (/etc/webmin/sysstats/sysstats.pl)

==> /var/log/yum.log < ==
Jul 27 06:21:32 Updated: samba-client.i386 3.0.23a-1.fc4.1
Jul 27 06:21:48 Updated: samba.i386 3.0.23a-1.fc4.1
Jul 29 05:58:07 Updated: httpd.i386 2.0.54-10.4
Aug 03 05:17:40 Updated: libtiff.i386 3.7.1-6.fc4.3
Aug 03 05:17:43 Updated: rrdtool.i386 1.2.15-3.fc4
Aug 03 05:17:49 Updated: libtiff-devel.i386 3.7.1-6.fc4.3
Aug 03 05:17:55 Updated: gnupg.i386 1.4.5-1
Aug 03 05:17:55 Updated: rrdtool-devel.i386 1.2.15-3.fc4
Aug 05 04:41:34 Updated: sed.i386 4.1.5-4.fc4
Sep 16 04:22:27 Updated: perl-IO-Multiplex.noarch 1.08-5.fc4

Note that in using tail with this method you can specify some wildcards for the name. For example, if every log ends with .log then you can use the command like this:

sudo tail -f -n 10 /var/log/{system,messages,console,yum}.log

Post Metadata

Date
October 3rd, 2006

Author
Glenn Batuyong

Category

Tags

blog comments powered by Disqus