MultiTail to monitor multiple log files

Multitail opening multiple logs

SysAdmins and developers often need to access multiple log files at the same time during monitoring and control to effectively solve tasks. To achieve this, each log file is usually opened in a new shell, in the traditional wise way, i.e. tail -f /var/log/messages.

However, if you want to display multiple log files in real time, the Multitail tool can be pulled in.

Install Multitail on CentOS

The EPEL repository must be added.

Multitail installation on Fedora or CentOS 7 as follows.

Multitail for Debian and Ubuntu

Multitail is installed on Debian with apt-get.

By default, multitail does the same as tail -f, the files are displayed in real time to open two different files in one window, the basic syntax is:

For Debian above, and for CentOS (Red Hat) as follows, in addition, netstat -t shows the active connections to the web server:

All access_log logs are opened in the logs directories, and the Apache Color schema displays the active connections to the web server.

The same output, but the first 3 logfiles in 3 columns, here is an Apache web server on CentOS:

Pressing the ‘b’ key will display a list of the open log files, which can be selected individually by cursor.

multitail

To scroll through the log files, press ‘b’ and scroll up or down with the cursor keys, for help you press ‘h’ to output the available option in a list.

When scrolling, typing ‘G’ or ‘gg’ can get to the beginning or end of the log file, with ‘q’ you return and then leave multitail.

Postfix also has a color scheme, the syntax for /var/log/maillog as follows:

Many color schemes are defined in the /etc/multitail.conf configuration, for example for Asterisk, Bind, Samba, tcpdump and many more, new ones can be added, or the existing ones can be modified.

To prevent the multitail line with the parameters from having to be re-entered each time, the line can be executed from a script, the following lines can be easily inserted into a terminal:

The script /usr/bin/mtail still needs to be made executable:

Here are just a few basic applications of the multitail command. A complete list of options can be found in the multitail man page, with multitail -h the syntax help is output with a wide selection of possible parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *