Skip to content

Commit

Permalink
Merge pull request #197 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…95-to-release-4.6

[release-4.6] Bug 1896691: Collect docker logs from WinEvent log on Windows machines
  • Loading branch information
openshift-merge-robot committed Dec 4, 2020
2 parents b35e739 + 91761ad commit 5377c81
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions collection-scripts/gather_windows_node_logs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
BASE_COLLECTION_PATH="/must-gather"
WINDOWS_NODE_LOGS=$BASE_COLLECTION_PATH/host_service_logs/windows

# Services logging to WinEvent log
SERVICES=(docker)

# Logfile list
LOGS=(kube-proxy/kube-proxy.exe.INFO kube-proxy/kube-proxy.exe.ERROR kube-proxy/kube-proxy.exe.WARNING)
LOGS+=(hybrid-overlay/hybrid-overlay.log kubelet/kubelet.log)
Expand All @@ -12,11 +15,19 @@ if [ -z "$WIN_NODES" ]; then
exit 0
fi

PIDS=()
LOG_WINEVENT_DIR=${WINDOWS_NODE_LOGS}/log_winevent/
mkdir -p ${LOG_WINEVENT_DIR}
echo INFO: Collecting logs for all Windows nodes
for service in ${SERVICES[@]}; do
echo "INFO: Collecting WinEvent application logs for provider $service"
/usr/bin/oc adm node-logs -l kubernetes.io/os=windows -u $service > ${LOG_WINEVENT_DIR}/${service}_winevent.log &
PIDS+=($!)
done
for log in ${LOGS[@]}; do
LOG_DIR=${WINDOWS_NODE_LOGS}/$(dirname $log)
mkdir -p ${LOG_DIR}
/usr/bin/oc adm node-logs -l kubernetes.io/os=windows --path=$log > ${LOG_DIR}/$(basename $log) &
LOG_FILE_DIR=${WINDOWS_NODE_LOGS}/log_files/$(dirname $log)
mkdir -p ${LOG_FILE_DIR}
/usr/bin/oc adm node-logs -l kubernetes.io/os=windows --path=$log > ${LOG_FILE_DIR}/$(basename $log) &
PIDS+=($!)
done
wait ${PIDS[@]}
Expand Down

0 comments on commit 5377c81

Please sign in to comment.