From 76c0292bcafee4456d5601b3485b6e21fdb27503 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Thu, 12 Jan 2023 19:27:40 +0800 Subject: [PATCH] [skip e2e]Update export log script (#21654) Signed-off-by: zhuwenxing --- .github/ISSUE_TEMPLATE/bug_report.yaml | 4 ++-- deployments/export-log/README.md | 4 ++-- deployments/export-log/export-milvus-log.sh | 18 +++++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 8825a98ab0..fc0eb200b1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -64,7 +64,7 @@ body: - type: textarea attributes: label: Milvus Log - description: Detailed error log information is helpful for finding Milvus problems. You can use this script to export Milvus logs. + description: Detailed error log information is helpful for finding Milvus problems. **You can use this script to export Milvus logs.** validations: required: false - type: textarea @@ -73,4 +73,4 @@ body: description: | Links? References? Anything that will give us more context about the issue you are encountering! validations: - required: false + required: false \ No newline at end of file diff --git a/deployments/export-log/README.md b/deployments/export-log/README.md index 79b4b931b6..8df1524548 100644 --- a/deployments/export-log/README.md +++ b/deployments/export-log/README.md @@ -20,9 +20,9 @@ For better tracking and debugging Milvus, the script `export-milvus-log.sh` is p | e | Export etcd logs | false | | m | Export Minio logs | false | | p | Export pulsar logs | false | -| k | Export Kafka logs | False | +| k | Export Kafka logs | false | | s | Only return logs newer than a relative duration like 5s, 2m,or 3h. Defaults to all logs | all | -|o |If milvus installed by milvus-operator |false | +| o | If milvus installed by milvus-operator | false | > By default, the script only exports the logs of the Milvus component. > > If you need to export the logs of etcd, minio, and pulsar components, you need to add the parameters -e, -m, -p. diff --git a/deployments/export-log/export-milvus-log.sh b/deployments/export-log/export-milvus-log.sh index c382b5e92a..9b65db3f38 100755 --- a/deployments/export-log/export-milvus-log.sh +++ b/deployments/export-log/export-milvus-log.sh @@ -28,8 +28,8 @@ do m) minio="true";; p) pulsar="true";; k) kafka="true";; - o) operator="true";; - s) since=$OPTARG;; + o) operator="true";; + s) since=$OPTARG;; *) echo "Unkonwen parameters";; esac done @@ -40,9 +40,11 @@ then exit 1 fi -if [ ! -d $log_path ]; +if [ ! -d $log_path/pod_log ] || [ ! -d $log_dir/pod_log_previous ] || [ ! -d $log_dir/pod_describe ]; then - mkdir -p $log_path + mkdir -p $log_path/pod_log + mkdir -p $log_path/pod_log_previous + mkdir -p $log_path/pod_describe fi if [ $since ]; @@ -61,12 +63,14 @@ function export_log(){ if [ $(kubectl get pod $pod -n $namespace --output=jsonpath={.status.containerStatuses[0].restartCount}) == 0 ]; then echo "Export log of $pod" - kubectl logs $pod -n $namespace ${since_args}> $log_path/$pod.log + kubectl logs $pod -n $namespace ${since_args}> $log_path/pod_log/$pod.log else echo "Export log of $pod" - kubectl logs $pod -n $namespace -p ${since_args}> $log_path/$pod-pre.log - kubectl logs $pod -n $namespace ${since_args}> $log_path/$pod.log + kubectl logs $pod -n $namespace -p ${since_args}> $log_path/pod_log_previous/$pod.log + kubectl logs $pod -n $namespace ${since_args}> $log_path/pod_log/$pod.log fi + echo "Export describe of $pod" + kubectl describe pod $pod -n $namespace > $log_path/pod_describe/$pod.log done }