From c33a55737b5518bbf0261554cc2bc9d5060f498e Mon Sep 17 00:00:00 2001 From: Amal Bansode Date: Wed, 24 Jun 2026 08:40:23 -0700 Subject: [PATCH] ipn/ipnlocal: reduce excessive logging of exit node suggestions (#20237) The logging added in 12188c0 was generating excessive spam in backend logs. This may have been exacerbated by tailscale GUI<->backend architecture on certain platforms like Windows, where the GUI polls for exit node suggestions rather than listening on the IPN bus. Change this to log on error or if the current suggestion differs from the previous suggestion. Updates tailscale/corp#43691 Updates #20194 Signed-off-by: Amal Bansode --- ipn/ipnlocal/local.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index b2b13fbc4..f14da1f1b 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -8851,6 +8851,8 @@ func fillAllowedSuggestions(polc policyclient.Client) (set.Set[tailcfg.StableNod // preferredDERP is this device's home DERP region (0 if unknown) and // regionLatency is the best recent latency to each DERP region; both come from // netcheck and are only used by the DERP-based algorithm. +// +// Errors are always logged. Suggestions are logged if they defer from prevSuggestion. func suggestExitNode(preferredDERP int, regionLatency map[int]time.Duration, nb *nodeBackend, prevSuggestion tailcfg.StableNodeID, selectRegion selectRegionFunc, selectNode selectNodeFunc, allowList set.Set[tailcfg.StableNodeID]) (res apitype.ExitNodeSuggestionResponse, err error) { switch { case nb.SelfHasCap(tailcfg.NodeAttrTrafficSteering): @@ -8865,8 +8867,10 @@ func suggestExitNode(preferredDERP int, regionLatency map[int]time.Duration, nb if err != nil { nb.logf("netmap: suggested exit node: %v", err) } else { - name, _, _ := strings.Cut(res.Name, ".") - nb.logf("netmap: suggested exit node: %s (%s)", name, res.ID) + if res.ID != prevSuggestion { + name, _, _ := strings.Cut(res.Name, ".") + nb.logf("netmap: suggested exit node: %s (%s)", name, res.ID) + } } return res, err }