Skip to content

Mirror console logs to file - #761

Merged
lukasfrank merged 1 commit into
mainfrom
maxmoehl/console-logs
Aug 4, 2026
Merged

Mirror console logs to file#761
lukasfrank merged 1 commit into
mainfrom
maxmoehl/console-logs

Conversation

@maxmoehl

@maxmoehl maxmoehl commented Jul 31, 2026

Copy link
Copy Markdown
Member

Currently, the only way to observe boot logs is by attaching to the serial console manually. This often misses very early boot logs which cannot be recovered.

This commit adds a log config to the serial console to ensure its output is mirrored into a file so that it can be inspected even when the early boot phase was missed.

Resolves: #737

Summary by CodeRabbit

  • New Features

    • Added persistent host-side console logging for machines while preserving interactive serial-console access.
    • Console logs now capture output from early boot and append across machine restarts.
    • Machine log directories and console log files are created automatically.
  • Documentation

    • Expanded console documentation with log locations, access details, append behavior, and cleanup instructions.

Currently, the only way to observe boot logs is by attaching to the
serial console manually. This often misses very early boot logs which
cannot be recovered.

This commit adds a log config to the serial console to ensure its output
is mirrored into a file so that it can be inspected even when the early
boot phase was missed.

Resolves: #737
Signed-off-by: Maximilian Moehl <maximilian@moehl.eu>
@maxmoehl
maxmoehl requested a review from a team as a code owner July 31, 2026 15:02
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d638bae-ad55-4251-a2de-3047c02bacc4

📥 Commits

Reviewing files that changed from the base of the PR and between 79fdca0 and 7f4f8e7.

📒 Files selected for processing (4)
  • docs/concepts/console.md
  • internal/controllers/machine_controller.go
  • internal/controllers/machine_controller_test.go
  • internal/host/host.go

📝 Walkthrough

Walkthrough

The provider now creates per-machine log directories and configures libvirt to append serial console output to console.log while retaining interactive PTY access. Integration tests validate the domain XML and log files. Documentation describes access, persistence, and cleanup.

Changes

Machine console logging

Layer / File(s) Summary
Machine log paths and directories
internal/host/host.go
The Paths interface resolves machine log directories and console log files. MakeMachineDirs creates the logs directory.
Serial logging integration and validation
internal/controllers/machine_controller.go, internal/controllers/machine_controller_test.go, docs/concepts/console.md
The serial device appends output to the machine console log. Lifecycle tests validate the XML configuration and file creation. Documentation describes console access, persistence, and cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: integration-tests, area/compute

Suggested reviewers: friegger

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: mirroring console output to a file.
Description check ✅ Passed The description explains the problem, proposed solution, and linked issue, although it does not use the exact template headings.
Linked Issues check ✅ Passed The changes persist serial console output locally and preserve early boot logs, satisfying issue #737's initial scope.
Out of Scope Changes check ✅ Passed The documentation, implementation, path helpers, and tests directly support persistent machine console logging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch maxmoehl/console-logs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lukasfrank
lukasfrank merged commit 648d27c into main Aug 4, 2026
11 checks passed
@lukasfrank
lukasfrank deleted the maxmoehl/console-logs branch August 4, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collect and Expose Early Boot Logs of Machines

2 participants