Skip to content

Include SSH logs in workspace diagnostics - #372

Merged
fioan89 merged 2 commits into
mainfrom
feature/include-workspace-ssh-logs
Oct 16, 2026
Merged

fioan89 merged 2 commits into
mainfrom
feature/include-workspace-ssh-logs

Conversation

@fioan89

@fioan89 fioan89 commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Currently, workspace log collection includes only the generated support bundle and omits local CLI SSH logs needed to investigate connection failures.

This commit adds an SSH log collector that reads the directory resolved by the CLI manager and copies matching session and rotated logs into workspace diagnostics. The collector applies a three-day cutoff and retains the last 50 MiB per file to limit archive size. The remote environment supplies its known SSH process ID so the collector includes the active log regardless of age without repeating process discovery.

The support bundle collector now continues SSH log collection after bundle failures, and the diagnostic collectors include the matching session ID in warnings when available. The README documents the included files and fixed limits, while regression tests cover directory resolution, log selection, truncation, cancellation, and failure handling.

Currently, workspace log collection includes only the generated support
bundle and omits local CLI SSH logs needed to investigate connection
failures.

This commit adds an SSH log collector that reads the directory resolved
by the CLI manager and copies matching session and rotated logs into
workspace diagnostics. The collector applies a three-day cutoff and
retains the last 50 MiB per file to limit archive size. The remote
environment supplies its known SSH process ID so the collector includes
the active log regardless of age without repeating process discovery.

The support bundle collector now continues SSH log collection after
bundle failures, and the diagnostic collectors include the matching
session ID in warnings when available. The README documents the included
files and fixed limits, while regression tests cover directory resolution,
log selection, truncation, cancellation, and failure handling.

- resolves https://linear.app/codercom/issue/JET-34
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

JET-34

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

internal fun supportsKeyringStorage(os: OS?): Boolean = os == OS.MAC || os == OS.WINDOWS

/** Resolves the log directory used by `coder ssh`, including its XDG state directory default. */
internal fun getSshLogDirectory(

@code-asher code-asher Oct 16, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we set --log-dir on the proxy command? That would remove the need to sniff out what dir the cli would use, and it could be nice to keep the Jetbrains connection logs in a separate dir.

And while the cli probably will not change the default location, it would protect us against such a change.

And maybe best of all, it would work for older clis that still do not log by default (although this could also be a downside because it would predate the cleanup as well...).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asher if you are ok with this, I'll explore in a separate PR this approach.

@fioan89
fioan89 merged commit 856fab3 into main Oct 16, 2026
6 checks passed
@fioan89
fioan89 deleted the feature/include-workspace-ssh-logs branch October 16, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants