Skip to content

Collect SSH logs directly into the support bundle - #373

Merged
fioan89 merged 1 commit into
mainfrom
simplify-ssh-log-collection
Oct 19, 2026
Merged

fioan89 merged 1 commit into
mainfrom
simplify-ssh-log-collection

Conversation

@fioan89

@fioan89 fioan89 commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Currently, the plugin guesses where the Coder CLI writes its SSH logs by reimplementing the CLI's platform-specific default directory rules. The SSH log collector then stages copies of the logs in a separate folder, and the support bundle collector copies the bundle, appends the staged files to the copy and swaps it in, with retries for Windows file locks. It also collects rotated and bare PID files, and its handling of reused PIDs and of cleanup is hard to follow.

With this change, the plugin chooses the SSH log directory itself and passes it to the CLI's SSH ProxyCommand with --log-dir for CLI 2.4.0 and newer, so collection, cleanup and the ProxyCommand always use the same path. The SSH log collector filters the shared directory down to coder-ssh*-.log files first, then adds every file modified within the last three days, plus the file of the active SSH process regardless of age, directly into the support bundle using zip4j. Each file is cut to its last 50 MB. When the bundle is missing or invalid, the logs go into a separate coder-ssh.zip instead. Cleanup now follows the same rule as the VS Code extension: only files outside the newest 20 and older than seven days are removed.

CLIs older than 2.4.0 write their logs to the CLI default location, which the plugin no longer looks at unless the SSH log directory is configured to point there. The README and changelog describe the new behavior.

Currently, the plugin guesses where the Coder CLI writes its SSH logs by
reimplementing the CLI's platform-specific default directory rules. The SSH
log collector then stages copies of the logs in a separate folder, and the
support bundle collector copies the bundle, appends the staged files to the
copy and swaps it in, with retries for Windows file locks. It also collects
rotated and bare PID files, and its handling of reused PIDs and of cleanup is
hard to follow.

With this change, the plugin chooses the SSH log directory itself and passes it
to the CLI's SSH ProxyCommand with --log-dir for CLI 2.4.0 and newer, so
collection, cleanup and the ProxyCommand always use the same path. The SSH log
collector filters the shared directory down to coder-ssh*-<pid>.log files
first, then adds every file modified within the last three days, plus the file
of the active SSH process regardless of age, directly into the support bundle
using zip4j. Each file is cut to its last 50 MB. When the bundle is missing or
invalid, the logs go into a separate coder-ssh.zip instead. Cleanup now follows
the same rule as the VS Code extension: only files outside the newest 20 and
older than seven days are removed.

CLIs older than 2.4.0 write their logs to the CLI default location, which the
plugin no longer looks at unless the SSH log directory is configured to point
there. The README and changelog describe the new behavior.
@fioan89
fioan89 requested review from EhabY, aqandrew, code-asher, jeremyruppel and matifali and removed request for code-asher October 16, 2026 22:29

@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.

Dope!

@fioan89
fioan89 merged commit c5b7832 into main Oct 19, 2026
6 checks passed
@fioan89
fioan89 deleted the simplify-ssh-log-collection branch October 19, 2026 17:12
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