Strip secret fields from grpc logging
@@ -19,6 +19,7 @@ package gceGCEDriver
import (
csi "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
+ "github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
@@ -49,12 +50,12 @@ func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeS
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
glog.V(3).Infof("GRPC call: %s", info.FullMethod)
- glog.V(5).Infof("GRPC request: %+v", req)
+ glog.V(5).Infof("GRPC request: %+v", protosanitizer.StripSecrets(req))
resp, err := handler(ctx, req)
if err != nil {
glog.Errorf("GRPC error: %v", err)
} else {
- glog.V(5).Infof("GRPC response: %+v", resp)
+ glog.V(5).Infof("GRPC response: %+v", protosanitizer.StripSecrets(resp))
}
return resp, err
}
