Skip to content

Commit

Permalink
Convert lib/joinserver to use slog
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy committed Dec 17, 2024
1 parent 7384627 commit e48cd1d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/joinserver/joinserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"github.com/gravitational/trace"
"github.com/jonboulle/clockwork"
"github.com/sirupsen/logrus"
"google.golang.org/grpc/peer"

"github.com/gravitational/teleport/api/client"
Expand Down Expand Up @@ -110,7 +109,7 @@ func (s *JoinServiceGRPCServer) RegisterUsingIAMMethod(srv proto.JoinService_Reg
if peerInfo, ok := peer.FromContext(srv.Context()); ok {
nodeAddr = peerInfo.Addr.String()
}
logrus.Warnf("IAM join attempt timed out, node at (%s) is misbehaving or did not close the connection after encountering an error.", nodeAddr)
slog.WarnContext(srv.Context(), "IAM join attempt timed out, agent is misbehaving or did not close the connection after encountering an error", "agent_addr", nodeAddr)
// Returning here should cancel any blocked Send or Recv operations.
return trace.LimitExceeded("RegisterUsingIAMMethod timed out after %s, terminating the stream on the server", iamJoinRequestTimeout)
}
Expand Down Expand Up @@ -181,7 +180,7 @@ func (s *JoinServiceGRPCServer) RegisterUsingAzureMethod(srv proto.JoinService_R
if peerInfo, ok := peer.FromContext(srv.Context()); ok {
nodeAddr = peerInfo.Addr.String()
}
logrus.Warnf("Azure join attempt timed out, node at (%s) is misbehaving or did not close the connection after encountering an error.", nodeAddr)
slog.WarnContext(srv.Context(), "Azure join attempt timed out, agent is misbehaving or did not close the connection after encountering an error", "agent_addr", nodeAddr)
// Returning here should cancel any blocked Send or Recv operations.
return trace.LimitExceeded("RegisterUsingAzureMethod timed out after %s, terminating the stream on the server", azureJoinRequestTimeout)
}
Expand Down Expand Up @@ -231,10 +230,10 @@ func setBotParameters(ctx context.Context, req *types.RegisterUsingTokenRequest)
if ident.BotInstanceID != "" {
// Trust the instance ID from the incoming identity: bots will
// attempt to provide it on renewal, assuming it's still valid.
logrus.WithFields(logrus.Fields{
"bot_name": ident.BotName,
"bot_instance_id": ident.BotInstanceID,
}).Info("bot is rejoining")
slog.InfoContext(ctx, "bot is rejoining",
"bot_name", ident.BotName,
"bot_instance_id", ident.BotInstanceID,
)
req.BotInstanceID = ident.BotInstanceID
} else {
// Clear any other value from the request: the value must come from a
Expand Down

0 comments on commit e48cd1d

Please sign in to comment.