大网数据广告活动
服务器运维问答

How to only look at the last 10 minutes of a log and grep for statement

· 52CE 我爱测

I'm looking for a way to only look through the last 10 mins of a WebLogic log file that has line formatting like this. ####<Sep 21, 2018 1:56:20 PM EDT> <Notice> <Stdout> I want to grep for a specific string and if it fails wait …

问题原文

原帖链接 · Robert Foster · CC BY-SA 4.0

I'm looking for a way to only look through the last 10 mins of a WebLogic log file that has line formatting like this.

####<Sep 21, 2018 1:56:20 PM EDT> <Notice> <Stdout>

I want to grep for a specific string and if it fails wait 60 seconds and try again. This would be for RHEL 7, and I'm open to using sed, awk, etc.

已采纳解答

原帖链接 · kenlukas · CC BY-SA 4.0

Since you're using RHEL 7 WebLogic is probably using systemd now. Which means you can take advantage of journalctl and the --since option.

From this article https://www.qualogy.com/techblog/oracle/introducing-weblogic-to-systemd# it looks like you'll use either wls_nodemanager or wls_adminserver or both. To view both use:

journalctl -u wls_nodemanager -u wls_adminserver --since "10min ago"

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-09-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。