当前位置:网站首页>大规模服务异常日志检索
大规模服务异常日志检索
2022-07-04 15:42:00 【Wu_Candy】
[email protected] bin # more check_log.sh #检查一个目录下所有指定日志文件中的报错日志脚本
#!/usr/bin/env bash #是对shell的声明
base="/home/project" #定义一个变量,用于指定扫描日志的目录
while [[ 1 ]]; do #shell 中无限循环定义
for name in `ls $base | grep -vE "default"`; #for 循环开始遍历目录下的文件,过滤掉default目录
do #开始执行
echo base/name #输出目录路径
if [[ -d base/name ]]; then #判断是否是目录
result=`grep -C10 base/name/logs/catalina.out | grep -vE "DEBUG|skywalking|10.8.0.37:8800" | grep -C5 -E "Exception|ERROR"`
# 获取catalina.out 文件中报Exception|ERROR的日志,过滤掉DEBUG|skywalking|10.8.0.37:8800这三类信息
if [[ -z "
continue; #继续
fi #if 结束符
echo -e "\n\033[31mfind Exception in
fi #if 结束符
done #do 结束符
echo -e "sleep 60 seconds\n" #输出休息一分钟
sleep 60s #等待一分钟
done #do 结束符
Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁。Shell 既是一种命令语言,又是一种程序设计语言。
Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务。
Shell 脚本(shell script),是一种为 shell 编写的脚本程序。
边栏推荐
- 2022PMP考试基本情况详情了解
- R语言plotly可视化:plotly可视化多分类变量小提琴图(multiple variable violin plot in R with plotly)
- DataKit——真正的统一可观测性 Agent
- How to implement a delay queue?
- Analysis of abnormal frequency of minor GC in container environment
- How to choose one plus 10 pro and iPhone 13?
- 容器环境minor gc异常频繁分析
- leetcode:421. The maximum XOR value of two numbers in the array
- Is it safe for CITIC Securities to open an account online? Is the account opening fee charged
- Visual studio 2019 (localdb) mssqllocaldb SQL Server 2014 database version is 852 and cannot be opened. This server supports 782
猜你喜欢

What is low code development?

【Go ~ 0到1 】 第六天 文件的读写与创建

To sort out messy header files, I use include what you use

如何实现一个延时队列 ?

VB cannot access database stocks

完美融入 Win11 风格,微软全新 OneDrive 客户端抢先看

Hidden corners of coder Edition: five things that developers hate most

周大福践行「百周年承诺」,真诚服务推动绿色环保

C# 服务器日志模块

一加10 Pro和iPhone 13怎么选?
随机推荐
中信证券网上开户安全吗 开户收费吗
安信证券属于什么档次 开户安全吗
关于nacos启动时防火墙开启8848的坑
To sort out messy header files, I use include what you use
一文掌握数仓中auto analyze的使用
整理混乱的头文件,我用include what you use
S2b2b solution for lighting industry: efficiently enable the industrial supply chain and improve the economic benefits of enterprises
leetcode:421. 数组中两个数的最大异或值
Yanwen logistics plans to be listed on Shenzhen Stock Exchange: it is mainly engaged in international express business, and its gross profit margin is far lower than the industry level
【HCIA持续更新】广域网技术
Solution of dealer collaboration system in building materials industry: empowering enterprises to build core competitiveness
智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
Years of training, towards Kata 3.0! Enter the safe container experience out of the box | dragon lizard Technology
Understand ThreadLocal in one picture
tx.origin安全问题总结
解读数据安全治理能力评估框架2.0,第四批DSG评估征集中
Leetcode list summary
The test experience "tortured" by the PMP test is worth your review
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
World Environment Day | Chow Tai Fook serves wholeheartedly to promote carbon reduction and environmental protection