diff --git a/lib/service/service.go b/lib/service/service.go index 97fbd4a03e370..24c1d123e23ec 100644 --- a/lib/service/service.go +++ b/lib/service/service.go @@ -4932,7 +4932,7 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error { transportService, err := transportv1.NewService(transportv1.ServerConfig{ FIPS: cfg.FIPS, - Logger: process.log.WithField(teleport.ComponentKey, "transport"), + Logger: process.logger.With(teleport.ComponentKey, "transport"), Dialer: proxyRouter, SignerFn: func(authzCtx *authz.Context, clusterName string) agentless.SignerCreator { return agentless.SignerFromAuthzContext(authzCtx, accessPoint, clusterName) diff --git a/lib/srv/transport/transportv1/transport.go b/lib/srv/transport/transportv1/transport.go index f019875186af7..c1ce020707ae6 100644 --- a/lib/srv/transport/transportv1/transport.go +++ b/lib/srv/transport/transportv1/transport.go @@ -22,12 +22,13 @@ import ( "context" "errors" "io" + "log/slog" "net" "net/netip" + "reflect" "sync" "github.com/gravitational/trace" - "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh/agent" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -63,7 +64,7 @@ type ServerConfig struct { // to run in FIPS mode. FIPS bool // Logger provides a mechanism to log output. - Logger logrus.FieldLogger + Logger *slog.Logger // Dialer is used to establish remote connections. Dialer Dialer // SignerFn is used to create an [ssh.Signer] for an authenticated connection. @@ -93,7 +94,7 @@ func (c *ServerConfig) CheckAndSetDefaults() error { } if c.Logger == nil { - c.Logger = utils.NewLogger().WithField(teleport.ComponentKey, "transport") + c.Logger = slog.With(teleport.ComponentKey, "transport") } if c.agentGetterFn == nil { @@ -247,7 +248,7 @@ func (s *Service) ProxySSH(stream transportv1pb.TransportService_ProxySSHServer) req, err := stream.Recv() if err != nil { if !utils.IsOKNetworkError(err) && !errors.Is(err, context.Canceled) && status.Code(err) != codes.Canceled { - s.cfg.Logger.Errorf("ssh stream terminated unexpectedly: %v", err) + s.cfg.Logger.ErrorContext(ctx, "ssh stream terminated unexpectedly", "error", err) } return @@ -262,7 +263,7 @@ func (s *Service) ProxySSH(stream transportv1pb.TransportService_ProxySSHServer) case *transportv1pb.ProxySSHRequest_Agent: agentStream.incomingC <- frame.Agent.Payload default: - s.cfg.Logger.Errorf("received unexpected ssh frame: %T", frame) + s.cfg.Logger.ErrorContext(ctx, "received unexpected ssh frame", "frame", reflect.TypeOf(frame)) continue } }