tail is one of the best tool to view log files in a real time (tail -f /path/to/log.file). The program MultiTail lets you view one or multiple files like the original tail program. The difference is that it creates multiple windows on your console (with ncurses). This is one of those dream come true program for UNIX sys admin job. You can browse through several log files at once and do various operations like search for errors and much more.
Install MultiTail
Type the following command under Debian / Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install multitail
If you are using FreeBSD, enter:
# portsnap fetch update
# cd /usr/ports/sysutils/multitail
# make install clean
How To View Multiple Files Like tail Command
To view /var/log/messages and /var/log/auth.log, enter:
# multilog /var/log/messages /var/log/auth.log
Sample output:
How do I run a command and view a log file?
Simply use command as follows:
# multitail /var/log/iptables.log -l "ping server.nixcraft.in"
OR
# multitail /var/log/httpd.log -l "netstat -nat"
The -l option allows command to execute in a window. Do not forget to use "'s if the external command needs parameter! (e.g. -l "ping host").
How do I display 3 logfiles in 2 columns?
To see all 3 files related to anti mail server gateway, enter:
# multitail -s 2 /var/log/maillog /var/log/FuzzyOcr.log /var/log/antivirus.log
multitail has many other useful options. Please read man page for further details:
man multitail
No comments:
Post a Comment