canonical / canonical/multipass

Introduce a way to capture libssh logs

Open
#3,560 1 comment 0 reactions 0 assignees View on GitHub
wishlist
Dominant language
C++
Stars
9.2k
Forks
828
Avg merge
3d 1h
Merged PRs (30d)
44

Description

**What are you trying to do?**
libssh emits its own logs, which could be very useful for debugging purposes. As of now, we completely ignore them. There are the following levels:
| Level | Description |
|-|-|
| `SSH_LOG_NOLOG` | No logging at all |
| `SSH_LOG_WARNING` | Only warnings |
| `SSH_LOG_PROTOCOL` | High level protocol information |
| `SSH_LOG_PACKET` | Lower level protocol infomations, packet level |
| `SSH_LOG_FUNCTIONS` | Every function path |

I think the most useful one for debugging would be `SSH_LOG_PROTOCOL`.

**What's your proposed solution?**
There could be several approaches:
1. Log everything emitted by libssh under our own `trace` level. We could always set the libssh verbosity level to `SSH_LOG_PROTOCOL`, capture every log and log it using the Multipass logging facilities, under the `trace` level.
2. Read an environment variable (perhaps `MULTIPASS_LIBSSH_VERBOSITY`) for the value we want to pass to `ssh_set_log_level`.
3. Combine approach 1 and 2. Capture everything from `SSH_LOG_PROTOCOL` and log under `trace`, but only if an environment variable is set (perhaps `MULTIPASS_LIBSSH_LOGGING`).

**Additional context**
The need for this comes from #3552.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the libssh logging levels and its ssh_set_log_level API, then inspect the Multipass logging facilities. Resolve which proposed capture and environment-variable approach is wanted; done means useful libssh logs are captured through Multipass logging at the intended verbosity without changing normal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.