MCPcopy
hub / github.com/kubernetes/test-infra / createFullSystemdLogfile

Function createFullSystemdLogfile

logexporter/cmd/main.go:117–129  ·  view source on GitHub ↗

createFullSystemdLogfile creates logfile for full systemd journal in the outputDir.

(outputDir string)

Source from the content-addressed store, hash-verified

115
116// createFullSystemdLogfile creates logfile for full systemd journal in the outputDir.
117func createFullSystemdLogfile(outputDir string) error {
118 cmd := exec.Command("journalctl", "--output=short-precise", "-D", *journalPath)
119 // Run the command and record the output to a file.
120 output, err := cmd.Output()
121 if err != nil {
122 return fmt.Errorf("Journalctl command failed: %w", err)
123 }
124 logfile := filepath.Join(outputDir, "systemd.log")
125 if err := os.WriteFile(logfile, output, 0444); err != nil {
126 return fmt.Errorf("Writing full journalctl logs to file failed: %w", err)
127 }
128 return nil
129}
130
131// Create logfiles for systemd services in outputDir.
132func createSystemdLogfiles(outputDir string) {

Callers 1

createSystemdLogfilesFunction · 0.85

Calls 1

OutputMethod · 0.80

Tested by

no test coverage detected