createFullSystemdLogfile creates logfile for full systemd journal in the outputDir.
(outputDir string)
| 115 | |
| 116 | // createFullSystemdLogfile creates logfile for full systemd journal in the outputDir. |
| 117 | func 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. |
| 132 | func createSystemdLogfiles(outputDir string) { |
no test coverage detected