ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

【RHCA+】multitail命令(监控日志)

【RHCA+】multitail命令(监控日志)

“ 目录:RHCA+ -> 12 系统监控 -> 11 multitail命令(监控日志) ”

类似于tail,可打开多个窗口,同时动态监控多个文件;语法格式:multitail [参数] [文件名]

参数

作用

-e

指定监控哪个关键字

-i

指定监控哪个文件

-l

指定监控哪个命令

一、安装

[root@wuzuniao ~]# yum -y install epel-release.noarch #安装EPEL仓库

[root@wuzuniao ~]# yum -y install multitail #安装软件包

二、使用

[root@wuzuniao ~]# multitail -e "fail" /var/log/messages #监控日志中关键字

Jun 26 22:02:29 wuzuniao journal: failed to get edid data: EDID length is too small

Jun 26 22:02:30 wuzuniao journal: failed to get edid: unable to get EDID for output

00] /var/log/messages *Press F1/+ for help* 879KB - 2024/06/26 23:52:28

[root@wuzuniao ~]# multitail -i /var/log/messages #监控日志文件所有日志

Jun 26 23:31:00 wuzuniao chronyd[739]: Selected source 202.112.31.197

Jun 26 23:40:01 wuzuniao systemd: Started Session 16 of user root.

Jun 26 23:47:02 wuzuniao yum[61325]: Installed: multitail-6.5.0-1.el7.x86_64

Jun 26 23:50:01 wuzuniao systemd: Started Session 17 of user root.

Jun 26 23:53:01 wuzuniao systemd: Started Session 18 of user root.

00] /var/log/messages *Press F1/+ for help* 879KB - 2024/06/26 23:53:33

[root@wuzuniao ~]# multitail -l "ping www.wuzuniao.com" #监控命令执行情况

PING 34kt72m0.slt-dk.sched.tdnsv8.com (27.221.72.110) 56(84) bytes of data.

64 bytes from 27.221.72.110 (27.221.72.110): icmp_seq=1 ttl=54 time=47.1 ms

64 bytes from 27.221.72.110 (27.221.72.110): icmp_seq=2 ttl=54 time=34.1 ms

64 bytes from 27.221.72.110 (27.221.72.110): icmp_seq=3 ttl=54 time=34.4 ms

00] ping www.wuzuniao.com 147MB (VMsize) 61530 (PID) - 2024/06/26 23:55:20

[root@wuzuniao ~]#

RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进