Since this is a perl program, there is no compiling involved. Swatch comes with a useful install script that will copy all the libraries, man pages, and perl files to their respective directories. Once done installing, all that is left is creating a configuration file and then launching the program. The configuration file, called swatchrc, is the heart of the swatch program. This text file tells swatch what logs to monitor, what triggers to look for, and what to do if triggered.
Swatch works by looking for regular expressions that match the triggers defined in swatchrc.
When it finds a match, it executes the notification procedure defined in swatchrc. We will now create a swatchrc file for our sendmail logging we discussed above. The goal is to have sendmail email us whenever someone is messing with our email system. We defined this earlier as anyone attempting unauthorized mail relay or the expn command. The syntax of a swatchrc file is as follows.