大叔经验分享(75)常用组件日志清理

包括cloudera-manager、hdfs、impala、kudu、oozie以及系统日志等;

#cloudera-service-monitor log
/bin/rm /var/lib/cloudera-service-monitor/ts/*/partition*/* -rf
/bin/rm /var/lib/cloudera-host-monitor/ts/*/partition*/* -rf

#hdfs log
/bin/rm /var/log/hadoop-hdfs/*.out.*
/bin/rm /var/log/hadoop-hdfs/hdfs-audit.log.*

#impala log
num=`ls /var/log/impalad/|grep 'impala.log.INFO'|wc -l`
ls /var/log/impalad/|grep 'impala.log.INFO'|sed $num'd'|xargs -i /bin/rm /var/log/impalad/{}
num=`ls /var/log/impalad/|grep 'impala.log.WARNING'|wc -l`
ls /var/log/impalad/|grep 'impala.log.WARNING'|sed $num'd'|xargs -i /bin/rm /var/log/impalad/{}
num=`ls /var/log/impalad/|grep 'impala.log.ERROR'|wc -l`
ls /var/log/impalad/|grep 'impala.log.ERROR'|sed $num'd'|xargs -i /bin/rm /var/log/impalad/{}

num=`ls /var/log/impalad/profiles/|wc -l`
ls /var/log/impalad/profiles/|sed $num'd'|xargs -i /bin/rm /var/log/impalad/profiles/{}

#kudu log
num=`ls /var/log/kudu/|grep 'log.INFO'|wc -l`
ls /var/log/kudu/|grep 'log.INFO'|sed $num'd'|xargs -i /bin/rm /var/log/kudu/{}
num=`ls /var/log/kudu/|grep 'log.ERROR'|wc -l`
ls /var/log/kudu/|grep 'log.ERROR'|sed $num'd'|xargs -i /bin/rm /var/log/kudu/{}
num=`ls /var/log/kudu/|grep 'log.FATAL'|wc -l`
ls /var/log/kudu/|grep 'log.FATAL'|sed $num'd'|xargs -i /bin/rm /var/log/kudu/{}
num=`ls /var/log/kudu/|grep 'log.WARNING'|wc -l`
ls /var/log/kudu/|grep 'log.WARNING'|sed $num'd'|xargs -i /bin/rm /var/log/kudu/{}
/bin/rm /var/log/kudu/*.gz #oozie log num=`ls /var/log/oozie/|grep 'log.out-'|wc -l` ls /var/log/oozie/|grep 'log.out-'|sed $num'd'|xargs -i /bin/rm /var/log/oozie/{} /bin/rm /var/log/oozie/oozie-instrumentation.log.* #system journal /bin/rm /var/log/journal/*/system@00000000000000000000000000000000-*.journal /bin/rm -rf /var/log/messages-*

 

posted @ 2019-07-03 16:39  匠人先生  阅读(607)  评论(0编辑  收藏  举报