From 19ad87ba002de54a668ecac9e0c17517b5bf2324 Mon Sep 17 00:00:00 2001 From: Jiaxun Song Date: Wed, 26 Jan 2022 16:26:33 -0800 Subject: [PATCH] fix logs collection issues --- diagnosis/README.md | 2 +- diagnosis/azs-collect-windows-logs.ps1 | 3 +-- diagnosis/hosts.sh | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/diagnosis/README.md b/diagnosis/README.md index 3a88c5e..9efaed3 100644 --- a/diagnosis/README.md +++ b/diagnosis/README.md @@ -63,7 +63,7 @@ az account set --subscription # download the scripts. mkdir -p $HOME/kuberneteslogs cd $HOME/kuberneteslogs -curl -L https://github.com/msazurestackworkloads/azurestack-gallery/releases/download/diagnosis-v1.1.0/diagnosis-v1.1.0.tar.gz -o diagnosis.tar.gz +curl -L https://github.com/msazurestackworkloads/azurestack-gallery/releases/download/diagnosis-v1.2.0/diagnosis-v1.2.0.tar.gz -o diagnosis.tar.gz tar xvf diagnosis.tar.gz # use the script to collect logs diff --git a/diagnosis/azs-collect-windows-logs.ps1 b/diagnosis/azs-collect-windows-logs.ps1 index ba4ad2c..5bb29fb 100644 --- a/diagnosis/azs-collect-windows-logs.ps1 +++ b/diagnosis/azs-collect-windows-logs.ps1 @@ -88,5 +88,4 @@ Get-ChildItem "$($ENV:TEMP)\waagent" | Foreach-Object { Write-Host "Compressing all logs to $zipName" $paths | Format-Table FullName, Length -AutoSize Compress-Archive -LiteralPath $paths -DestinationPath $zipName -Remove-Item -Path $paths -ErrorAction SilentlyContinue -Get-ChildItem $zipName # this puts a FileInfo on the pipeline so that another script can get it on the pipeline \ No newline at end of file +Remove-Item -Path $paths -Recurse -Confirm:$false -Force -ErrorAction SilentlyContinue diff --git a/diagnosis/hosts.sh b/diagnosis/hosts.sh index 994142a..dbe8b52 100644 --- a/diagnosis/hosts.sh +++ b/diagnosis/hosts.sh @@ -11,10 +11,10 @@ test -n "${NAMESPACES}" && NAMESPACES="kube-system${NAMESPACES}" && echo "[$(dat if [ -z "${NAMESPACES}" ]; then - kubectl cluster-info dump --all-namespaces --output-directory ${LOGDIRECTORY} &> /dev/null + sudo kubectl cluster-info dump --all-namespaces --output-directory ${LOGDIRECTORY} --kubeconfig /etc/kubernetes/admin.conf &> /dev/null else - kubectl cluster-info dump --namespaces "${NAMESPACES}" --output-directory ${LOGDIRECTORY} &> /dev/null + sudo kubectl cluster-info dump --namespaces "${NAMESPACES}" --output-directory ${LOGDIRECTORY} --kubeconfig /etc/kubernetes/admin.conf &> /dev/null fi -(cd $TMP && zip -q -r ~/${WD}.zip ${WD}) +(cd $TMP && sudo zip -q -r ~/${WD}.zip ${WD} && sudo chmod 777 ~/${WD}.zip) sudo rm -f -r $TMP