Skip to content

Commit 5a1d08f

Browse files
authored
Merge pull request #71 from Jefftree/reduce-log
Prevent logging packet data in client
2 parents ef0d890 + 1169cd6 commit 5a1d08f

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

konnectivity-client/pkg/client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (t *grpcTunnel) serve() {
8888
return
8989
}
9090

91-
klog.Infof("[tracing] recv packet %+v", pkt)
91+
klog.V(6).Infof("[tracing] recv packet, type: %s", pkt.Type)
9292

9393
switch pkt.Type {
9494
case client.PacketType_DIAL_RSP:
@@ -165,7 +165,7 @@ func (t *grpcTunnel) Dial(protocol, address string) (net.Conn, error) {
165165
},
166166
},
167167
}
168-
klog.Infof("[tracing] send packet %+v", req)
168+
klog.V(6).Infof("[tracing] send packet, type: %s", req.Type)
169169

170170
err := t.stream.Send(req)
171171
if err != nil {

konnectivity-client/pkg/client/conn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (c *conn) Write(data []byte) (n int, err error) {
5454
},
5555
}
5656

57-
klog.Infof("[tracing] send req %+v", req)
57+
klog.V(6).Infof("[tracing] send req, type: %s", req.Type)
5858

5959
err = c.stream.Send(req)
6060
if err != nil {
@@ -122,7 +122,7 @@ func (c *conn) Close() error {
122122
},
123123
}
124124

125-
klog.Infof("[tracing] send req %+v", req)
125+
klog.V(6).Infof("[tracing] send req, type: %s", req.Type)
126126

127127
if err := c.stream.Send(req); err != nil {
128128
return err

pkg/agent/agentclient/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (a *AgentClient) Serve() {
117117
return
118118
}
119119

120-
klog.Infof("[tracing] recv packet %+v", pkt)
120+
klog.Infof("[tracing] recv packet, type: %s", pkt.Type)
121121

122122
if pkt == nil {
123123
klog.Warningf("empty packet received")
@@ -183,7 +183,6 @@ func (a *AgentClient) Serve() {
183183
case client.PacketType_DATA:
184184
data := pkt.GetData()
185185
klog.Infof("received DATA(id=%d)", data.ConnectID)
186-
klog.Infof("[tracing] %v", data)
187186

188187
if ctx, ok := a.connContext[data.ConnectID]; ok {
189188
ctx.dataCh <- data.Data

pkg/agent/agentserver/tunnel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (t *Tunnel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
127127
klog.Errorf("error sending packet %v", err)
128128
continue
129129
}
130-
klog.Infof("Forwarding on tunnel, packet %v", string(pkt[:n]))
130+
klog.Infof("Forwarding on tunnel, packet type: %s", packet.Type)
131131
}
132132

133133
klog.Infof("Stopping transfer to %q", r.Host)

0 commit comments

Comments
 (0)