mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Allow dumping full systemd journal in log-dump.sh.
The feature is gated behind a newly introduced 'dump-systemd-journal' flag. We want to dump the full systemd journal in our scalability performance tests.
This commit is contained in:
		@@ -51,6 +51,7 @@ readonly kern_logfile="kern.log"
 | 
			
		||||
readonly initd_logfiles="docker/log"
 | 
			
		||||
readonly supervisord_logfiles="kubelet.log supervisor/supervisord.log supervisor/kubelet-stdout.log supervisor/kubelet-stderr.log supervisor/docker-stdout.log supervisor/docker-stderr.log"
 | 
			
		||||
readonly systemd_services="kubelet kubelet-monitor kube-container-runtime-monitor ${LOG_DUMP_SYSTEMD_SERVICES:-docker}"
 | 
			
		||||
readonly dump_systemd_journal="${LOG_DUMP_SYSTEMD_JOURNAL:-false}"
 | 
			
		||||
 | 
			
		||||
# Limit the number of concurrent node connections so that we don't run out of
 | 
			
		||||
# file descriptors for large clusters.
 | 
			
		||||
@@ -164,6 +165,10 @@ function save-logs() {
 | 
			
		||||
        for svc in "${services[@]}"; do
 | 
			
		||||
            log-dump-ssh "${node_name}" "sudo journalctl --output=cat -u ${svc}.service" > "${dir}/${svc}.log" || true
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
        if [[ "$dump_systemd_journal" == "true" ]]; then
 | 
			
		||||
          log-dump-ssh "${node_name}" "sudo journalctl --output=short-precise" > "${dir}/systemd.log" || true
 | 
			
		||||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        files="${kern_logfile} ${files} ${initd_logfiles} ${supervisord_logfiles}"
 | 
			
		||||
    fi
 | 
			
		||||
 
 | 
			
		||||
@@ -100,6 +100,8 @@ type TestContextType struct {
 | 
			
		||||
	// SystemdServices are comma separated list of systemd services the test framework
 | 
			
		||||
	// will dump logs for.
 | 
			
		||||
	SystemdServices string
 | 
			
		||||
	// DumpSystemdJournal controls whether to dump the full systemd journal.
 | 
			
		||||
	DumpSystemdJournal       bool
 | 
			
		||||
	ImageServiceEndpoint     string
 | 
			
		||||
	MasterOSDistro           string
 | 
			
		||||
	NodeOSDistro             string
 | 
			
		||||
@@ -249,6 +251,7 @@ func RegisterCommonFlags() {
 | 
			
		||||
	flag.StringVar(&TestContext.ContainerRuntimeProcessName, "container-runtime-process-name", "dockerd", "The name of the container runtime process.")
 | 
			
		||||
	flag.StringVar(&TestContext.ContainerRuntimePidFile, "container-runtime-pid-file", "/var/run/docker.pid", "The pid file of the container runtime.")
 | 
			
		||||
	flag.StringVar(&TestContext.SystemdServices, "systemd-services", "docker", "The comma separated list of systemd services the framework will dump logs for.")
 | 
			
		||||
	flag.BoolVar(&TestContext.DumpSystemdJournal, "dump-systemd-journal", false, "Whether to dump the full systemd journal.")
 | 
			
		||||
	flag.StringVar(&TestContext.ImageServiceEndpoint, "image-service-endpoint", "", "The image service endpoint of cluster VM instances.")
 | 
			
		||||
	flag.StringVar(&TestContext.DockershimCheckpointDir, "dockershim-checkpoint-dir", "/var/lib/dockershim/sandbox", "The directory for dockershim to store sandbox checkpoints.")
 | 
			
		||||
	flag.StringVar(&TestContext.KubernetesAnywherePath, "kubernetes-anywhere-path", "/workspace/k8s.io/kubernetes-anywhere", "Which directory kubernetes-anywhere is installed to.")
 | 
			
		||||
 
 | 
			
		||||
@@ -4599,6 +4599,8 @@ func CoreDump(dir string) {
 | 
			
		||||
		cmd = exec.Command(path.Join(TestContext.RepoRoot, "cluster", "log-dump", "log-dump.sh"), dir)
 | 
			
		||||
	}
 | 
			
		||||
	cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices)))
 | 
			
		||||
	cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_JOURNAL=%v", TestContext.DumpSystemdJournal))
 | 
			
		||||
 | 
			
		||||
	cmd.Stdout = os.Stdout
 | 
			
		||||
	cmd.Stderr = os.Stderr
 | 
			
		||||
	if err := cmd.Run(); err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user