oozie日志查看 oozie日志过滤

14 篇文章 3 订阅
2 篇文章 0 订阅

在很多中小型公司,oozie作为调度框架应用还是较为广泛的。oozie其实支持多种丰富类型的action,但在实际使用中可能大多数开发会直接选择sh action(俺也一样 …)。
在开发调试和上线的过程中,日志的查看都很重要,可以帮助我们了解ooize工作的基本流程和快速定位错误。


一、怎么查看oozie日志?

# 普通日志
oozie job -log workflowId/coordId
# 错误日志
oozie job -errorlog workflowId/coordId

二、日志过滤

1. 使用shell命令,简单粗暴

方法就是直接在上述日志查看命令后使用head、tail、grep、sed、cut等各种命令组合获取到自己想要的日志,也能满足需求,不过实际工作中发现当历史日志(尤其针对coord日志,因为包含所有历史周期任务日志)很多的时候,使用tail等过滤最新日志速度会非常缓慢,此时便不得不考虑使用官方提供的命令参数对日志进行过滤了。

2.oozie日志过滤参数

日志过滤参数讲解官方文档链接

# 用法 User can provide multiple option to filter logs using 
oozie job -log wj/coord -logfilter opt1=val1\;opt2=val1\;opt3=val1
# ;前的\用于转义,如果使用""则无需转义"opt1=val1;opt2=val1"
# 简单解释
recent:使用距离当前的时间间隔过滤。单位为时或分,分别用H/h或M/m表示,默认为时
start:直接定义日志开始的时间。时间格式"yyyy-MM-dd'T'HH:mm'Z'""yyyy-MM-dd HH:mm:ss,SSS"
end:直接定义日志结束的时间。格式同上
loglevel:定义日志的类型。可选ALL, DEBUG, ERROR, INFO, TRACE, WARN, FATAL(必须大写,多个用"|"隔开即可)
limit:限制日志返回条数

# 官方原文
recent: Specify recent hours/min of logs to scan. The recent offset specified is taken relative to the end time specified, job end time or the current system time if the job is still running in that order of precedence. For eg: recent=3h or recent=30m will fetch logs starting 3 hours/30 minutes before the end time and up to the end time. H/h is used to denote hour and M/m is used to denote minutes. If no suffix is specified default is hours.
start: Start time for scanning logs. Default is start time of the job. User can provide a valid date or offset similar to recent option. Valid date formats are "yyyy-MM-dd'T'HH:mm'Z'" and "yyyy-MM-dd HH:mm:ss,SSS". When an offset is specified, it is calculated relative to the start time of the job. For eg: start=2h will fetch logs starting 2 hours after the job was started.
end: End time for scanning logs. Default is end time of the job or current system time if the job is still running. User can provide a valid date or offset similar to start option. When an offset is specified, it is calculated relative to start time i.e job start time . For eg: end=2h will fetch logs from start time and start time plus 2 hours.
loglevel : Multiple log levels separated by "|" can be specified. Supported log levels are ALL, DEBUG, ERROR, INFO, TRACE, WARN, FATAL.
text: String to search in logs.
limit : Limit number of line to be searched. Log search will end when when n lines(excluding stack-trace) have been matched.
debug : Prints debug information on the log files, time ranges and patterns being searched for. Can be used to debug if expected logs are not shown with the filter options provided.


总结

使用oozie help log可查看到下述帮助文档,但是解释属实过于简单了,其实很久前就看到了,没看明白用法也懒得翻文档就放弃了,现在历史日志实在是太多了,使用方法一需要时间过长,不得已又去求助了官方文档 。。。
建议大家有啥需求也都去官方网站看看,会获益匪浅的,新的一年大家一起变得更强!
linux帮助文档
官方文档截图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值