Kernel Logging   «Prev 

Sending Log messages to an Alphanumeric Pager

You can configure your Linux system to send log messages to an alphanumeric pager. You probably only want severe messages sent to the pager, and you can configure this behavior through /etc/syslog.conf and a cron script.
First, decide which messages you want to send to the pager and give them a special logfile. The example below sends all critical kernel (kern.crit selector) messages and all emergency messages to the /var/log/emergency logfile.

Pager: This applet shows a tiny view of the multiple desktop areas of your GNOME environment. By default, there are four desktops available. You can change to a different desktop by clicking the area in the pager. Each minidesktop area shows small representations of the active windows within that desk.

kern.crit /var/log/emergency
*.emerg /var/log/emergency

Next, configure a cron job to run every 20 seconds and check to see if /var/log/emergency exists. If it does, mail the file's contents to the alphapager then delete the file.
The /etc/syslog.conf file doesn't directly support sending email, so you need the cron job to mail the logfile.

Using rsh for remote execution

While previous commands, such as rcp and ftp, can help you share files among computers on your network, rsh lets you share the processors. With rsh, it is simple to ask that a command be run on any computer for which you have rhosts access. Likewise, you can have the command's output printed on your screen, directed to a local file, or directed to a remote file.
Here are four examples of the rsh command:

$ rsh spruce who
$ rsh maple "tail -f /var/log/messages"
$ rsh pine "man rlogin" >> /tmp/rlman
$ rsh fir "uname -a" ">>" /tmp/name

In the first example, the who command is run on the remote computer named spruce and the output appears on the local screen. The second example runs the tail -f command to display messages as they arrive in the /var/log/messages file on maple. (This is a good way to remotely monitor log files in one quick command line.) The next command runs the man command to output the rlogin man page and outputs the results to the /tmp/rlman file on the local system. In the final example, the uname -a command runs on fir, but by quoting the arrows, the output is sent to the /tmp/name file on the remote computer, rather than the local one.