Skip to content

chore: add uuid's to ssh sessions for logging #10721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 17, 2023
Merged

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Nov 15, 2023

While debugging some ssh logs, it was hard to know which connections were still open. Assigning a uuid helped figure out the "life" of a sessions. It is very easy to match the "handle" and "exit" ssh log lines with the uuids.

Wish I could use context

Very annoying I could not add the logger fields to the context, but ssh context is a specific struct that embeds a context.Context. You cannot do context.WithValue() on it, so slog.With() cannot be used.

It does have a ctx.SetValue(), but slog's context value struct is not exported, so I cannot pass slog fields this way.

@Emyrk Emyrk requested review from deansheather and mafredri and removed request for deansheather November 15, 2023 22:22
@Emyrk Emyrk marked this pull request as ready for review November 15, 2023 22:24
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Good chance! I've had plans to improve this but unfortunately haven't gotten around to working on the package.

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
@Emyrk Emyrk enabled auto-merge (squash) November 17, 2023 15:57
@Emyrk Emyrk merged commit e448c10 into main Nov 17, 2023
@Emyrk Emyrk deleted the stevenmasley/ssh_session_id branch November 17, 2023 16:04
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants