Clone wiki

alerta / Home

Alerta project

Alerta is a log monitoring and reporting application that goes beyond the basic functionalities found in traditional log tailers. It has amongst other features:

  • Multitailing capability. It can tail multiple logs at a time
  • Colors for every level: warn, info, debug, error and fatal
  • Emphasize multiple targets (log traces) given regular expressions
  • Follow log upon truncation by default
  • User defined colors for each level
  • Silent (daemonized) mode
  • Throttling mode. Slow down the information being printed in the terminal
  • Inactivity log monitoring
  • mail notification
  • Pause Modes freezes output for a limited period of time depending on level found.
  • Analytics. Makes a report of each level found in logs when finished.
  • Different color schemes for each log
  • Tailing logs over SSH

Alerta has two basic components: log4tailer and log4server. Latest version is 3.0.9

Running the tailer

./log4tail [-s] [-n nlines] [-t "regex1,regex2,..."] [-c configfile] [-i seconds] [--throttle seconds] pathToLogs

Basic execution

In order to run the tailer just type:

./log4tail pathtologs

This command will tail the log4j formatted logs in a multicolored way. The default colors work well with a white or clear terminal color background. If you want to provide your own colors, you can, just run:

./log4tail -c configfile.txt pathtologs

configfile is optional and defines the colors to be used for each level, namely:

  • warn = yellow
  • info = green
  • debug = black
  • error = magenta
  • fatal = red

pathtologs can be provided with command line globbing, except when you run it in silence (daemonized mode) when you need to provide the full path to the logs.

Throttling mode

If your application logs information very fast, you can slow down the information being printed in your terminal by providing the --throttle option.

./log4tail --throttle numberofsecs pathtologs

The information will be printed in intervals of numberofsecs one line at a time

Silent mode

In silent mode the tailer will send FATAL alerts to an email account and will run silently as a daemon in the server. At this very moment only uses SMTP, and it will ask your account details in start up mode. Like smtp host, username and password. In case of a FATAL log trace it will send an email to the account provided, and in case of multiple FATAL alerts in a row, it has a 5 seconds gap between alerts to avoid sending multiple emails consecutively. In order to run this mode, just type:

./log4tail -s FULLPATHtologs

It will interactively ask you for smtp account details. To stop the daemon just killed.

Other features and options


The -t option will tail the logs and will emphasize in a red background color the line that complies with the regex specified in the -t option:

./log4tail -t "regex1,regex2,..." pathToLogs

Tail last n lines in log file

Self explanatory:

./log4tail -n nlines pathToLog

with the added feature that it will do it in *colors* :)