multitail_使用MultiTail for Linux监视单个Shell中的多个日志

multitail_使用MultiTail for Linux监视单个Shell中的多个日志

multitail

Whether you are responsible for a server or just a programmer doing development, you’ll often have more than one logfile that you want to track at the same time. There’s a nifty little utility for Linux called MultiTail that allows you to monitor multiple logs in a single window, instead of requiring multiple separate shell windows open.

无论您是负责服务器还是负责开发的程序员,通常都需要同时跟踪多个日志文件。 Linux上有一个漂亮的小实用程序MultiTail,它使您可以在一个窗口中监视多个日志,而无需打开多个单独的Shell窗口。

Installation

安装

First you’ll need to download and extract the source code using the following command. (Note that you should adjust these commands for the latest version if necessary)

首先,您需要使用以下命令下载并提取源代码。 (请注意,如有必要,应将这些命令调整为最新版本)

wget http://www.vanheusden.com/multitail/multitail-5.2.0.tgz

wget http://www.vanheusden.com/multitail/multitail-5.2.0.tgz

tar xvfz multitail-5.2.0.tgz

焦油xvfz multitail-5.2.0.tgz

Now change into the directory and run “make install” to both compile and install the application. You’ll need to be running as root to install this particular application, or you can just use sudo as shown:

现在转到目录并运行“ make install”以编译和安装应用程序。 您需要以root用户身份运行才能安装此特定应用程序,或者可以使用sudo,如下所示:

cd multitail-5.2.0

cd multitail-5.2.0

sudo make install

须藤使安装

At this point it’s completely installed and can be used by any user. The default installation location is /usr/bin/multitail

至此,它已经完全安装,任何用户都可以使用。 缺省安装位置是/ usr / bin / multitail

Usage

用法

You can merge logfiles into a horizontally split window by using the -i command before each logfile. This is most useful when you don’t have a lot of space or the lines in the file are very long.

您可以在每个日志文件之前使用-i命令将日志文件合并到水平拆分的窗口中。 当您没有足够的空间或文件中的行很长时,此功能非常有用。

multitail -i error_log -i access_log

multitail -i error_log -i access_log

multitail_使用MultiTail for Linux监视单个Shell中的多个日志

You can even use the -l command to show the output of a command, such as a ping or trace. This would also allow you to use scripts that strip out output that you don’t want… often you only want to see certain lines in a file, such as errors.

您甚至可以使用-l命令来显示命令的输出,例如ping或跟踪。 这也将允许您使用脚本来去除不需要的输出……通常,您只希望看到文件中的某些行,例如错误。

multitail -l “ping www.howtogeek.com” -l “ping blogs.howtogeek.com”

multitail -l“ ping www.howtogeek.com” -l“ ping blogs.howtogeek.com”

multitail_使用MultiTail for Linux监视单个Shell中的多个日志

There are loads of other options, which I will leave as an exercise for the reader. You can change the color schemes, split vertically as well as horizontally, or even view statistics on the logfiles.

还有很多其他选择,我将作为练习留给读者。 您可以更改配色方案,垂直和水平拆分,甚至查看日志文件的统计信息。

You can check out the examples page on the multitail homepage, or just use the –help option to see the giant list of options.

您可以在multitail主页上查看示例页面 ,或仅使用–help选项查看庞大的选项列表。

Download MultiTail from vanheusden.com

从vanheusden.com下载MultiTail

翻译自: https://www.howtogeek.com/howto/linux/monitor-multiple-logs-in-a-single-shell-with-multitail-for-linux/

multitail