后50000条日志

#!/bin/bash
log_dir=/export/icity/see_log/
deploy_1=lunling-linkage-core
deploy_2=hola-app-orchestrator-server
#log_date=`date +%F_%H`
. /etc/init.d/functions
function log_export() {
    mkdir -p ${log_dir}/$1
    for i in `kubectl get pod -n lunling | grep $1 | awk '{print $1}'`;
    do
        kubectl logs $i -n lunling --tail=50000 > ${log_dir}/$1/${i}_tail_50000.log
    done
}

log_export ${deploy_1}
log_export ${deploy_2}

find /export/icity/see_log -name "*.log" -mtime +3|xargs -i rm -f {} \;

一小时内日志

#!/bin/bash
log_dir=/export/icity/see_log/
log_date=`date +%F_%H`
deploy_1=lunling-linkage-core
deploy_2=hola-app-orchestrator-server
. /etc/init.d/functions

function log_export() {
    mkdir -p ${log_dir}/$1
    for i in `kubectl get pod -n lunling | grep $1 | awk '{print $1}'`;
    do
        kubectl logs $i -n lunling --since=1h > ${log_dir}/$1/${i}_${log_date}.log
    done
}

log_export ${deploy_1}
log_export ${deploy_2}

find /export/icity/see_log -name "*.log" -mtime +3|xargs -i rm -f {} \;

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐