mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: log tailnet tunnels to the connection log (#27423)
Co-authored-by: Chris DiGiamo <cd@anthropic.com> Co-authored-by: Chris DiGiamo <cdigiamo@anthropic.com>
This commit is contained in:
co-authored by
Chris DiGiamo
Chris DiGiamo
parent
8cc7f2bb0e
commit
1a6a8be96c
@@ -466,6 +466,20 @@ func (p *DBTokenProvider) connLogInitRequest(w http.ResponseWriter, r *http.Requ
|
||||
connType = database.ConnectionTypeWorkspaceApp
|
||||
}
|
||||
|
||||
// An empty slug_or_port is reserved for tunnel sessions (see
|
||||
// coderd/workspaceagents.go logTunnelConnection); writing one
|
||||
// here would collide with them in the audit session dedupe
|
||||
// index. Request.Check rejects empty slugs, so this is
|
||||
// unreachable today.
|
||||
if slugOrPort == "" {
|
||||
p.Logger.Critical(ctx, "workspace app audit session has empty slug_or_port, skipping connection log",
|
||||
slog.F("workspace_id", aReq.dbReq.Workspace.ID),
|
||||
slog.F("agent_id", aReq.dbReq.Agent.ID),
|
||||
slog.F("app_id", aReq.dbReq.App.ID),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// If we end up logging, ensure relevant fields are set.
|
||||
logger := p.Logger.With(
|
||||
slog.F("workspace_id", aReq.dbReq.Workspace.ID),
|
||||
|
||||
Reference in New Issue
Block a user