Skip to content

Quick start

Ralf Kilian edited this page Apr 24, 2017 · 27 revisions

Quick start guide

This is a short example for getting started with SaLoMon.

Starting situation

Let us assume that you have the log file /var/log/foobar.log containing these lines

2014-04-02 01:04:16 Starting foobar service
2014-04-02 01:04:17 Reading config file
2014-04-02 01:04:17 Warning: Config file 'foobar.cfg' not found
2014-04-02 01:04:18 Notice: Using fallback config file instead
2014-04-02 01:04:19 Configuration has been loaded successfully
2014-04-02 01:04:20 Running process #1
2014-04-02 01:04:24 Running process #2
2014-04-02 01:04:28 Running process #3
2014-04-02 01:04:32 Running process #4
2014-04-02 01:04:33 Error while running process #4
2014-04-02 01:04:34 Warning: At least one process has failed
2014-04-02 01:04:36 Stopping foobar service

and you want to highlight its contents as follows.

Colorize lines containing the term ...

  • error in light red,
  • warn in yellow,
  • success in light green,
  • start in light cyan,
  • stop also in light cyan,
  • notice in light blue and
  • read in light purple.

Color config file

Create a file with the following content:

lightred error
yellow warn
lightgreen success
lightcyan start
lightcyan stop
lightblue notice
lightpurple read

Save it as log_colors.cfg into the colors sub-directory.

Run SaLoMon

Now, you can simply execute the following command

$ ./salomon.sh -i /var/log/foobar.log -c log_colors.cfg --no-follow

to get the requested result:

SaLoMon output

The --no-follow argument used above is required if you just want to colorize an existing file that does not grow ("analyze" the file). If you want to watch and colorize a growing log file ("monitor" the file), leave the argument off.

Details can be found inside the documentation file usage_salomon.txt located in the docs sub-directory.