SaLoMon project


Contents:

Definition

What is SaLoMon?

SaLoMon logoThe SaLoMon project is a simple tool to monitor or analyze log as well as plain text files and colorize as well as highlight lines containing certain terms.




Details

Further information about the project.

The SaLoMon project comes with shell scripts, that run on Unix-like operating systems, only.

Its name is an abbreviation for Sane Log File Monitor.

The main script was primarily built to monitor and analyze log as well as plain text files on systems without a graphical user interface. It returns either all or just certain lines (by applying a filter) that have been added to the monitored file.

These lines can also easily be colorized with user-defined colors (and additionally highlighted) depending on given criteria. For example, all lines which contain the word "error" can be displayed red.



Sample output of the script:

Sample config file used to highlight:


SaLoMon output
SaLoMon config

The script uses popular shell utilities that should be pre-installed by default on Unix-like systems, see the requirements section for details.


The SaLoMon project was developed on (and for) the Bash shell, which is the default shell on many Unix-like systems.

No matter which shell you are using, the Bash shell must be installed in order to use SaLoMon.


Components

What the project consists of and what each component is for.

The project itself only consists of a single shell script to monitor or analyze log as well as plain text files as mentioned above in the details section.

There also is an install as well as a compatibility check script included, but these are basic tools to get SaLoMon running, not additional components.



Requirements

Stuff that is required to get SaLoMon running.

Tool requirements:

  • basename (version 8.21 or higher is recommended, details can be found here)
  • bash (version 4.2.53 or higher is recommended, details can be found here)
  • dirname (version 8.21 or higher is recommended, details can be found here)
  • grep (version 2.18 or higher is recommended, details can be found here)
  • printf (version 8.21 or higher is recommended, details can be found here)
  • readlink (version 8.21 or higher is recommended, details can be found here)
  • sed (version 2.50 or higher is recommended, details can be found here)
  • tail (version 2.81 or higher is recommended, details can be found here)

Some of these utilities are part of the coreutils package (click here for details).

Furthermore, the recommended versions mentioned above are the ones that have been used while developing SaLoMon. The project may also work with earlier versions.


Usage

How to use SaLoMon.

The project also comes with some help files which contain fundamental documentation as well as usage examples for each component of the project.

Usually, each script requires command-line arguments to operate. So, to get an overview of all arguments available, simply run the script with the --help argument. For example:


$ ./salomon.sh --help
usage: salomon.sh -a {analyze,monitor} -i INPUT_FILE [-c COLOR_FILE]
                  [-d DELAY] [-e EXCLUDE] [-f FILTER] [-h] [--highlight]
                  [--ignore-case] [--no-info] [-p] [-r REMOVE]
                  [-s] [--version] [-w WAIT]

Monitor or analyze log as well as plain text files and colorize as well as
highlight lines containing certain terms.

required arguments:
  -a {analyze,monitor}, --action {analyze,monitor}
                        action to perform with the input file
  -i INPUT_FILE, --input-file INPUT_FILE
                        input file to monitor

optional arguments:
  -c COLOR_FILE, --color-file COLOR_FILE
                        color config file for colorizing lines which contain
                        certain terms
  -d, --delay DELAY     delay for the '--slow' argument below (milliseconds,
                        number between 100 and 900, default is 200)
  -e EXCLUDE, --exclude EXCLUDE
                        exclude lines which a certain string (for details see
                        section 5 inside the documentation file)
  -f FILTER, --filter FILTER
                        print the lines that contain the given filter pattern,
                        only (for details see section 4 inside the
                        documentation file)
  -h, --help            print this help message and exit
  --highlight           highlight the filter terms (by inverting their colors)
  --ignore-case         ignore the case of the given filter pattern
  --no-info             do not display the information header and footer
  -p, --prompt          prompt before exit (in case the process gets cancelled
                        on user request)
  -r REMOVE, --remove REMOVE
                        remove a certain string from each line (for details
                        see section 6 inside the documentation file)
  -s, --slow            slow down the process (decreases CPU usage)
  -t, --temp-copy       process temporary copy of the input file instead of
                        the input file itself
  --version             print the version number and exit
  -w, --wait WAIT       seconds to wait after printing a colorized line

Further information and usage examples can be found inside the documentation
file for this script.
$


Download

Download the project.

GitHub logoDownloads and further information can be found on GitHub.