swatch (Simple Log Analyzer) is a perl program that can run as a daemon and continuously analyze log files for certain patterns to appear and then trigger an email notification. This program is also known as swatchdog.

Installation

swatch can be installed with the Pakfire web interface or via the console:

pakfire install swatch

Usage

There is no web interface for this Addon. To run this Addon open the client console or terminal and access the IPFire box via SSH.

You do definitely need a working MTA, like dma, installed on IPFire for swatch to actually work. Configure and test before continuing.

Furthermore you need a configuration file that tells swatch for which patterns it should look out and which action to trigger.

Example configuration file

The config is /etc/swatch/swatchdogrc

Sending email notification on the word "error", would look like this:

watchfor /error/
echo=normal
mail=alerts@your.domain,subject="error found"

Then tell swatchdog to start in daemon mode. Swatch will monitor the -tail file.

/usr/bin/swatchdog --daemon -c /etc/swatch/swatchdogrc -t /var/log/messages

To start this automatically at system startup, best put it in:

/etc/sysconfig/rc.local

Despite being named "simple" is a very powerful tool that can be used for all sorts of neat stuff.