multiTail.pl

multiTail.pl reads one or multiple log files. The files read can be shown on the screen or written into anther log file and saved. This way, you can mix multiple log files.
It is a very robust, so it doesn't care if a file is deleted, moved or newly created. You can also start it with a file name which does not exist at that time.

    multiTail.pl [-a] [-d delay] [-p begin|end]
        [--print] [-t] [-o outFile [-m max] [-P]
         [[-n noFiles] | [-s [-c compressprog]] ]
        ]
        [-C color=pattern [-C color=pattern ...]]
        [-g expression] files...

All options are optional, you simply have to use one or more log file names as parameter.

--addName / -a
Add the file name from which the line is read to the output.
--delay / -d
Delay in seconds between checking each file for new data. The value can by smaller than 1, e.g. 0.2. The default value is 5 (seconds).
--position / -p
At start of the program, read from the begin or end of the file; allowed parameters are begin or end. Default is begin.
--print
Print the options used (from the command line and from the configuration file) and stop after printing the options. In case of difficult quoting (especially on the command line) this gives you the chance to see what's really used in the program.
--withTime -t
Add a time stamp to the output.
--out / -o
write output to a file, default is stdout
--maxFilelen / -m
Maximal size of a log file. After reaching this size, the log file will be rotated (see option noOfOldFiles) or compressed (see option saveLogs).
--withPID / -P
write pid (process id) of multiTail.pl to the log file; default is not to write it
--maxlines / -l
Maximum number of lines to read in one chunk from a log file. Default is 100. If you configure ``--delay 3'' then every three seconds multiTail.pl will read a maximum of 100 lines. The reason for this restriction is to avoid that multiTail.pl will consume too much power if a log file is written too heavily.
--noOfOldFiles / -n
Number of old rotated log files, default is 5. With default values, it will look like this:

$ ls -l /tmp/storebackup.log*
-rw------- 1 hjc  root  328815 30. Aug 12:12 /tmp/storebackup.log
-rw------- 1 root root 1000087 27. Aug 21:18 /tmp/storebackup.log.1
-rw------- 1 root root 1000038 20. Aug 19:02 /tmp/storebackup.log.2
-rw------- 1 root root 1000094 11. Aug 18:51 /tmp/storebackup.log.3
-rw------- 1 root root 1000147 11. Aug 18:49 /tmp/storebackup.log.4
-rw------- 1 root root 1000030 11. Aug 18:49 /tmp/storebackup.log.5

Older log files than *.5 have been deleted automatically.

--saveLogs / -s
Save the log files with a time and date stamp instead of deleting them after rotating. (Setting this option overwrites the default value of option noOfOldFiles.)
--compressWith / -c
Specifies the program to compress the saved log files (e.g., with gzip -9). Default value is bzip2.
On the command line, the parameter to this option is parsed like a line in the configuration file and normally has to be quoted.
--color / -C
Filter a line to print it in a special color, e.g. red=ERROR means the whole line containing ERROR will be printed in red. You can use pattern matching for the part of the right side of the ``=''.
Supported colors are red, green, yellow, blue, magenta and cyan.
--grep / -g
Use this pattern to filter lines from the log files. No special color is used for output. If this option is missing, all lines are printed.

EXAMPLE:

multiTail.pl -p end -a -d 0.5 -C red=ERROR -C yellow=WARNING -g 'END|ERROR|WARNING' *.log

This will show only lines in the log file containing END, ERROR or WARNING. Lines containing WARNING will be printed in yellow, lines containing ERROR in red on the screen.

Heinz-Josef Claes 2014-04-20