Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Added - Add GroupUsersBan function to all runtimes. - Add Groups page and associated endpoints to the developer console. - Log a warning when client IP address cannot be resolved. ### Changed - Improve Stackdriver log format timestamp and message field formats. Loading server/api.go +10 −3 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ func extractClientAddressFromContext(logger *zap.Logger, ctx context.Context) (s clientAddr = peerInfo.Addr.String() } return extractClientAddress(logger, clientAddr) return extractClientAddress(logger, clientAddr, ctx, "context") } func extractClientAddressFromRequest(logger *zap.Logger, r *http.Request) (string, string) { Loading @@ -509,10 +509,10 @@ func extractClientAddressFromRequest(logger *zap.Logger, r *http.Request) (strin clientAddr = r.RemoteAddr } return extractClientAddress(logger, clientAddr) return extractClientAddress(logger, clientAddr, r, "request") } func extractClientAddress(logger *zap.Logger, clientAddr string) (string, string) { func extractClientAddress(logger *zap.Logger, clientAddr string, source interface{}, sourceType string) (string, string) { var clientIP, clientPort string if clientAddr != "" { Loading @@ -535,6 +535,13 @@ func extractClientAddress(logger *zap.Logger, clientAddr string) (string, string // At this point err may still be a non-nil value that's not a *net.AddrError, ignore the address. } if clientIP == "" { if r, isRequest := source.(*http.Request); isRequest { source = map[string]interface{}{"headers": r.Header, "remote_addr": r.RemoteAddr} } logger.Warn("cannot extract client address", zap.String("address_source_type", sourceType), zap.Any("address_source", source)) } return clientIP, clientPort } Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Added - Add GroupUsersBan function to all runtimes. - Add Groups page and associated endpoints to the developer console. - Log a warning when client IP address cannot be resolved. ### Changed - Improve Stackdriver log format timestamp and message field formats. Loading
server/api.go +10 −3 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ func extractClientAddressFromContext(logger *zap.Logger, ctx context.Context) (s clientAddr = peerInfo.Addr.String() } return extractClientAddress(logger, clientAddr) return extractClientAddress(logger, clientAddr, ctx, "context") } func extractClientAddressFromRequest(logger *zap.Logger, r *http.Request) (string, string) { Loading @@ -509,10 +509,10 @@ func extractClientAddressFromRequest(logger *zap.Logger, r *http.Request) (strin clientAddr = r.RemoteAddr } return extractClientAddress(logger, clientAddr) return extractClientAddress(logger, clientAddr, r, "request") } func extractClientAddress(logger *zap.Logger, clientAddr string) (string, string) { func extractClientAddress(logger *zap.Logger, clientAddr string, source interface{}, sourceType string) (string, string) { var clientIP, clientPort string if clientAddr != "" { Loading @@ -535,6 +535,13 @@ func extractClientAddress(logger *zap.Logger, clientAddr string) (string, string // At this point err may still be a non-nil value that's not a *net.AddrError, ignore the address. } if clientIP == "" { if r, isRequest := source.(*http.Request); isRequest { source = map[string]interface{}{"headers": r.Header, "remote_addr": r.RemoteAddr} } logger.Warn("cannot extract client address", zap.String("address_source_type", sourceType), zap.Any("address_source", source)) } return clientIP, clientPort } Loading