multitail; a tail replacement
tail provides enough log viewing experience for diagnosis, analysis, etc. However, its functionality is still limited and unable to provide additional features such as multiple logs viewing, colorize output, column support, and so on.
This, however, is possible using another package –
multitail. Multitail provides the support for logs coloring, columns, multiple logs, logs merging, interval command execution, and so on.
Install multitail in Ubuntu
$ sudo apt-get update $ sudo apt-get install multitail
Example #1: View 2 files simultenuosly
Supposed we want to monitor 2 Nginx sites’ access logs, here’s the command
$ multitail /var/log/nginx/site1.access.log /var/log/nginx/site2.access.log
Example #2: View 2 files merged as 1, with different colors
Let’s get more visuals. Now we want to monitor access logs and error logs as a single file, and each file is represented in different colors so we can differentiate them in our diagnostic.
$ multitail -ci green /var/log/nginx/site1.access.log \ -ci red -I /var/log/nginx/site1.error.log
Example #3: View 4 logs merged as 2 pair, in 2 columns
So you need to see how one site’s error relates to other sites. Now we want to monitor access & error logs of 2 sites in 2 columns. Each column represents a single site with green color for the access log and red color for the error log.
$ multitail -s 2 \ -ci green /var/log/nginx/site1.access.log -ci red -I /var/log/nginx/site1.error.log \ -ci green /var/log/nginx/site2.access.log -ci red -I /var/log/nginx/site2.error.log
There are a lot of possibilities you can explore depending on your use cases. For more information regarding
multitail, you can refer to the following sites.