None

Browse log files using multitail


Multitail is a powerful tool for monitoring multiple log files at once including a bunch of other features.

By Kostas Koutsogiannopoulos

In this example we are using multitail in order to browse at the same time the nginx access.log and uwsgi log file of a django application.

The package exists in the ubuntu repositories so we just run...

sudo apt-get install multitail

...to install it.

After installation:

multitail /var/log/nginx/access.log /var/log/uwsgi/epilis.log

Multitail opens the two files in monitor mode in two separate parts of the screen:

 

To open the file you want to browse press b:

 

Then choose the specific file you want to browse with enter:

 

Now you can use Page Up, Page Down and the Up, Down arrow keys το browse the file.

Press gg to go to the head and G to go to the bottom.

Press Y in order to deactivate and activate linewrap.

If you want to apply a color scheme to a log file there are two ways:

  1. With the following command we apply apache color scheme to the file /var/log/nginx/access.log
    multitail -cS apache /var/log/nginx/access.log /var/log/uwsgi/epilis.log
  2. We can apply the color scheme after the log file opening with the command...
    multitail /var/log/nginx/access.log /var/log/uwsgi/epilis.log
    and after press c, choose the /var/log/nginx/access.log, press S and choose the apache scheme with space.

You can see the list of available color schemes in /etc/multitail.conf or add your own in ~/.multitailrc (create the file if is not exists)

You can set a mark to a log file using the keys 0..9 (0 for the first file, 1 for the second etc):

 

Lets say that you are browsing a nginx access.log file but you do not interested in records containing your own ip address (xxx.xxx.xxx.xxx).

You can exclude those records using the following:

multitail -Ev "xxx.xxx.xxx.xxx" /var/log/nginx/access.log /var/log/uwsgi/epilis.log

A huge number of other options are available in multitail. At anytime you can press Ctrl-h to get an overlaid help window.

 

Pressing q, you can close the overlaid windows and eventualy quit the program.


View epilis's profile on LinkedIn Visit us on facebook Twitter epilis rss feed: Latest articles