![]() ![]() You can specify a different configuration file using the -c flag as shown in the following example.įirst create a swatch configuration directory and a file. Here, our regular expression is a literal string – “sudo”, means any time the string sudo appeared in the log file, would be printed to the terminal in red text and mail specify the action to be taken, which is to echo the matched pattern on the terminal and send an e-mail to the specified address, receptively.Īfter you have configured it, swatchdog reads the /var/log/syslog log file by default, if this file is not present, it reads /var/log/messages. We will use a simple configuration file, you can find more options in the swatchdog man page, for instance. You need to specify a pattern and an action(s) to be taken when a pattern is matched. $ touch /home/tecmint/.swatchdogrcĪdd your regular expression in this file and each line should contain a keyword and value (sometimes optional), separated by a space or an equal (=) sign. swatchrc), to determine what types of expression patterns to look for and what type of action(s) should be taken when a pattern is matched. Once you have installed the swatch, you need to create its configuration file (default location is /home/$USER/.swatchdogrc or. To install most latest version of swatchdog, you need to compile it from source using following commands in any Linux distribution. $ sudo yum install epel-release & sudo yum install swatch The package swatchdog is available to install from the official repositories of mainstream Linux distributions as a package “ swatch” via a package manager as shown. Importantly, swatchdog has grown from a script for watching logs produced by Unix’s syslog facility, and it can monitor just about any kind of logs. Read Also: 4 Good Open Source Log Monitoring and Management Tools for Linux Note that the program was originally called swatch (the “ Simple Watcher”) but a request by the old Swiss watch company for a name change saw the developer change its name to swatchdog. You can run it from the command line or in the background, detached from any terminal using the daemon mode option. ![]() It watches your logs based on regular expressions that you can define in a configuration file. Swatchdog (the “ Simple WATCH DOG”) is a simple Perl script for monitoring active log files on Unix-like systems such as Linux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |