shell小工具查看Hadoop中System.out输出的日志

#!/bin/bash
rm ~/log.log
echo "Please Input JobID:"
read NAME
map_log="/home/grid/hadoop-1.2.1/logs/userlogs/${NAME}/attempt_${NAME#*job_}_m_000000_0/stdout"
red_log="/home/grid/hadoop-1.2.1/logs/userlogs/${NAME}/attempt_${NAME#*job_}_r_000000_0/stdout"
echo "=========================================START=====================================" >> log.log
echo "Map:" >> log.log
cat $map_log >> log.log
echo "Reduce:" >> log.log
cat $red_log >> log.log
echo "==========================================END======================================" >> log.log
cat log.log

使用说明:
1.需要输入JobID,如:job_201407121609_0029
2.需要修改map_log和red_log这两个变量的值,以便适用于本机
3.注意:在JOB所在的机器运行,否则会报找不到目录
 
 
posted @ 2017-05-17 13:35  龙昊雪  阅读(379)  评论(0编辑  收藏  举报