broker: add INFO logs about reauthenticating
There was one at DEBUG level, but it may be useful to have this
information at the INFO level, and it is also useful to know when the
reauthentication happens.
@@ -283,6 +283,7 @@ func (b *broker) handleReqs() {
// can only have an expiry if we went the authenticate
// flow, so we know we are authenticating again.
// For KIP-368.
+ cxn.cl.cfg.logger.Log(LogLevelInfo, "sasl expiry limit reached, reauthenticating", "broker", cxn.b.meta.NodeID)
if err = cxn.sasl(); err != nil {
pr.promise(nil, err)
cxn.die()
@@ -785,8 +786,9 @@ func (cxn *brokerCxn) doSasl(authenticate bool) error {
if lifetimeMillis < 5000 {
return fmt.Errorf("invalid short sasl lifetime millis %d", lifetimeMillis)
}
- cxn.expiry = time.Now().Add(time.Duration(lifetimeMillis)*time.Millisecond - time.Second)
- cxn.cl.cfg.logger.Log(LogLevelDebug, "connection has a limited lifetime", "broker", cxn.b.meta.NodeID, "reauthenticate_at", cxn.expiry)
+ now := time.Now()
+ cxn.expiry = now.Add(time.Duration(lifetimeMillis)*time.Millisecond - time.Second)
+ cxn.cl.cfg.logger.Log(LogLevelInfo, "sasl has a limited lifetime", "broker", cxn.b.meta.NodeID, "reauthenticate_in", cxn.expiry.Sub(now))
}
return nil
}
