e2e/log-dump: Collect kernel log with journald

Related to #31928

The kern.log file does not exist on journald distros typically.
pull/6/head
Euan Kemp 2016-09-08 16:04:02 -07:00
parent 0037b67cdf
commit 6b226cbfd9
1 changed files with 5 additions and 3 deletions

View File

@ -58,18 +58,20 @@ function copy-logs-from-node() {
function save-logs() {
local -r node_name="${1}"
local -r dir="${2}"
local files="${3} ${common_logfiles}"
local files="${3}"
if [[ "${KUBERNETES_PROVIDER}" == "gce" || "${KUBERNETES_PROVIDER}" == "gke" ]]; then
files="${files} ${gce_logfiles}"
fi
if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
files="${files} ${aws_logfiles}"
fi
if ssh-to-node "${node_name}" "sudo systemctl status kubelet.service" &> /dev/null; then
ssh-to-node "${node_name}" "sudo journalctl --output=cat -u kubelet.service" > "${dir}/kubelet.log" || true
ssh-to-node "${node_name}" "sudo journalctl --output=cat -u docker.service" > "${dir}/docker.log" || true
ssh-to-node "${node_name}" "sudo journalctl --output=cat -k" > "${dir}/kern.log" || true
else
files="${files} ${initd_logfiles} ${supervisord_logfiles}"
files="${kern_logfile} ${files} ${initd_logfiles} ${supervisord_logfiles}"
fi
copy-logs-from-node "${node_name}" "${dir}" "${files}"
}
@ -81,7 +83,7 @@ readonly master_logfiles="kube-apiserver kube-scheduler kube-controller-manager
readonly node_logfiles="kube-proxy"
readonly aws_logfiles="cloud-init-output"
readonly gce_logfiles="startupscript"
readonly common_logfiles="kern"
readonly kern_logfile="kern"
readonly initd_logfiles="docker"
readonly supervisord_logfiles="kubelet supervisor/supervisord supervisor/kubelet-stdout supervisor/kubelet-stderr supervisor/docker-stdout supervisor/docker-stderr"