milvus/tests/scripts/export_log_k8s.sh
zhuwenxing 648608d84c
[skip ci]Update command to export error logs (#10694)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2021-10-26 21:12:20 +08:00

20 lines
382 B
Bash

#!/bin/bash
set -e
ns_name=$1
prefix_name=$2
array=($(kubectl get pod -n ${ns_name}|grep ${prefix_name}|awk '{print $1}'))
echo ${array[@]}
log_dir="k8s_logs"
if [ ! -d $log_dir ];
then
mkdir $log_dir
fi
echo "export logs start"
for pod in ${array[*]}
do
echo "export logs for pod $pod "
kubectl logs $pod -n ${ns_name} > ./$log_dir/$pod.log 2>&1
done
echo "export logs done"