From 59f39d40b3b19564f6cbfb03d8ef5c64a12a756a Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:20:14 +0800 Subject: [PATCH] Enable GRPC log for GNMI (#20798) #### Why I did it Currently, we don't have GRPC logs for the GNMI server, making it difficult to debug GRPC-level issues such as invalid certificates. #### How I did it Update gnmi-native.sh to enable GRPC_GO_LOG. #### How to verify it Send gnmi request and check gnmi log, for example: 2024 Nov 13 07:35:03.454423 str3 INFO gnmi#supervisord: gnmi-native WARNING: 2024/11/13 07:35:03 [core] grpc: Server.Serve failed to complete security handshake from "127.0.0.1:43530": tls: failed to verify client certificate: x509: certificate signed by unknown authority --- dockers/docker-sonic-gnmi/gnmi-native.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-sonic-gnmi/gnmi-native.sh b/dockers/docker-sonic-gnmi/gnmi-native.sh index b9241dca1d6a..1756ea1dba53 100755 --- a/dockers/docker-sonic-gnmi/gnmi-native.sh +++ b/dockers/docker-sonic-gnmi/gnmi-native.sh @@ -17,6 +17,10 @@ X509=$(echo $TELEMETRY_VARS | jq -r '.x509') GNMI=$(echo $TELEMETRY_VARS | jq -r '.gnmi') CERTS=$(echo $TELEMETRY_VARS | jq -r '.certs') +# Enable GRPC GO LOG +export GRPC_GO_LOG_VERBOSITY_LEVEL=99 +export GRPC_GO_LOG_SEVERITY_LEVEL=info + TELEMETRY_ARGS=" -logtostderr" export CVL_SCHEMA_PATH=/usr/sbin/schema