之前有同事希望在终端下开多个窗口查看服务状态,后来用xterm解决。
multitail可以很好的实现该功能,示例如下:multitail --label "baidu.com: " -l 'ping baidu.com' --label "sina.com: " -l 'ping sina.com' --label "taobao.com: " -l "ping taobao.com" --label "sohu.com: " -l "ping sohu.com" --label "syslog: " /var/log/syslog -l "vmstat 1" -sw 100,100 -sn 3,3
-sw 用来设置有多少列,每列的大小
-sn 配合-sw/-s使用,设置每列的窗口数
-C 放在multitail后面,输出颜色
进入后,按h帮助,大写O清屏,更多功能大家自己发掘把,比如:只显示差异
安装使用yum或者apt, apt-get install multitail
更多例子:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
Merge2logfiles inone window:
multitail/var/log/apache/access.log-I/var/log/apache/error.log
Show3logfiles in2columns:
multitail-s2/var/log/apache/access.log/var/log/messages/var/log/mail.log
Show5logfiles whilemerging2andput them in2columns with only one inthe left column:
multitail-s2-sn1,3 /var/log/apache/access.log-I/var/log/apache/error.log/var/log/messages\
/var/log/mail.log/var/log/syslog
Merge the output of2ping commands whileremoving"64 bytes received from"from only1of them:
multitail-l"ping 192.168.0.1"-ke"64 bytes from"-L"ping 192.168.0.2"
Show the output ofaping-command andifit displaysatimeout,sendamessage toall users
currently logged in
multitail-ex timeout"echo timeout | wall"-l"ping 192.168.0.1"
Inone window show all newTCP connections andtheir state changes using netstat whilein
the other window displaying the merged access anderror logfiles of apache
multitail-R2-l"netstat -t"/var/log/apache/access.log-I/var/log/apache/error.log
Asthe previosu example but also copy the output tothe file netstat.log
multitail-anetstat.log-R2-l"netstat -t tcp"/var/log/apache/access.log-I/var/log/apache/error.log
Show2logfiles merged inone window but give eachlogfileadifferent color so that you
can easily see what lines are forwhat logfile:
multitail-ci green/var/log/apache/access.log-ci red-I/var/log/apache/error.log
Show3rssfeeds merged inone window using rsstail
multitail-cS rsstail-l"rsstail -n 1 -z -l -d -u http://setiathome.berkeley.edu/rss_main.php"\
-cS rsstail-L"rsstail -n 1 -z -l -d -u http://www.biglumber.com/index.rss"-cS rsstail\
-L"rsstail -n 1 -z -l -u http://kernel.org/kdist/rss.xml"
ShowaSquid(proxy server)logfile whileconverting timestamps tosomething readable
multitail-cv squid/var/log/squid/access.log
DisplayQ-Mail logging whileconverting the timestamp into human readable format
multitail-cv qmailtimestr/var/log/qmail/qmail.smtpd.log
Merge ALL apache logfiles(*access_log/*error_log)into one window:
multitail-cS apache--mergeall/var/log/apache/*access_log--no-mergeall-cS apache_error\
--mergeall/var/log/apache/*error_log--no-mergeall
Monitor the logfile of an other system:
Forthisyou need tosetupacouple of things.MultiTail runs on systemA,the logfile on systemB.
Inthisexample we're going to monitor the apache logfile. Add the following to /etc/services:
apachelog 20000/tcp
Add this to /etc/inetd.conf:
apachelog stream tcp nowait root /usr/local/sbin/tail_apache_log /usr/local/sbin/tail_apache_log
and create the file /usr/local/sbin/tail_apache_log with the following content:
#!/bin/sh
/usr/bin/tail -f /var/log/apache2/access.log
make sure that you don'tforget tomake that script executable(chmod+xfilename).
Thenon hostAstart MultiTail like this:
multitail-cS apache-l"telnet B 20000"
Please note that logfiles go inplaintext across the network.You may also need toadjust
the files/etc/hosts.[allow|deny]on hostBtoonly allow hostAtoconnect.
Monitoring Tomcat
multitail-cS apache-cS log4j"${TOMCAT_HOME}/logs/catalina.out"
|
相关推荐
MultiTail是一个开源的ncurses的实用工具,可用于在一个窗口或单一外壳,显示实时一样的尾巴命令,该命令拆分控制台为更多子窗口的日志文件的最后几行(很像显示多个日志文件到标准输出屏幕命令 )。 它还支持...
multitail在AIX服务器下编译的执行码,可以在AIX实现多文件的查看,可以在自行网上搜索multitail的用法
mutalog是跨平台工具,用于同时着色和监视多个日志文件,类似于tail / MultiTail。
将节点添加到节点文件中每个条目都是一个节点名称,该名称以空格分隔,然后为该节点的cookie分隔。 node1@host1.somewhere cookie1 node2@host2.somewhere cookie2 通过使用schnell脚本开始跟踪;)将跟踪模式写在...
介绍13款Linux运维工具.zip httper nmap agedu tmux fail2ban multitail nmon htop iftop iptraf ...