Skip to content

Commit 71997be

Browse files
committed
TUN-7368: Report destination address for TCP requests in logs
1 parent 991f01f commit 71997be

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

proxy/proxy.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const (
3131
LogFieldOriginService = "originService"
3232
LogFieldFlowID = "flowID"
3333
LogFieldConnIndex = "connIndex"
34+
LogFieldDestAddr = "destAddr"
3435

3536
trailerHeaderName = "Trailer"
3637
)
@@ -171,14 +172,22 @@ func (p *Proxy) ProxyTCP(
171172

172173
tracedCtx := tracing.NewTracedContext(serveCtx, req.CfTraceID, p.log)
173174

174-
p.log.Debug().Str(LogFieldFlowID, req.FlowID).Uint8(LogFieldConnIndex, req.ConnIndex).Msg("tcp proxy stream started")
175+
p.log.Debug().
176+
Str(LogFieldFlowID, req.FlowID).
177+
Str(LogFieldDestAddr, req.Dest).
178+
Uint8(LogFieldConnIndex, req.ConnIndex).
179+
Msg("tcp proxy stream started")
175180

176181
if err := p.proxyStream(tracedCtx, rwa, req.Dest, p.warpRouting.Proxy); err != nil {
177182
p.logRequestError(err, req.CFRay, req.FlowID, "", ingress.ServiceWarpRouting)
178183
return err
179184
}
180185

181-
p.log.Debug().Str(LogFieldFlowID, req.FlowID).Uint8(LogFieldConnIndex, req.ConnIndex).Msg("tcp proxy stream finished successfully")
186+
p.log.Debug().
187+
Str(LogFieldFlowID, req.FlowID).
188+
Str(LogFieldDestAddr, req.Dest).
189+
Uint8(LogFieldConnIndex, req.ConnIndex).
190+
Msg("tcp proxy stream finished successfully")
182191

183192
return nil
184193
}

0 commit comments

Comments
 (0)