mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
wgengine/wglog: quieten WireGuard logs for allowedips
An increasing number of users have very large subnet route configurations, which can produce very large amounts of log data when WireGuard is reconfigured. The logs don't contain the actual routes, so they're largely useless for diagnostics, so we'll just suppress them. Fixes tailscale/corp#17532 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
e8d2fc7f7f
commit
131f9094fd
@ -52,6 +52,13 @@ func NewLogger(logf logger.Logf) *Logger {
|
||||
// See https://github.com/tailscale/tailscale/issues/1388.
|
||||
return
|
||||
}
|
||||
if strings.Contains(format, "Adding allowedip") {
|
||||
// Drop. See https://github.com/tailscale/corp/issues/17532.
|
||||
// AppConnectors (as one example) may have many subnet routes, and
|
||||
// the messaging related to these is not specific enough to be
|
||||
// useful.
|
||||
return
|
||||
}
|
||||
replace := ret.replace.Load()
|
||||
if replace == nil {
|
||||
// No replacements specified; log as originally planned.
|
||||
|
@ -64,6 +64,23 @@ type log struct {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSuppressLogs(t *testing.T) {
|
||||
var logs []string
|
||||
logf := func(format string, args ...any) {
|
||||
logs = append(logs, fmt.Sprintf(format, args...))
|
||||
}
|
||||
x := wglog.NewLogger(logf)
|
||||
x.DeviceLogger.Verbosef("pass")
|
||||
x.DeviceLogger.Verbosef("UAPI: Adding allowedip")
|
||||
|
||||
if len(logs) != 1 {
|
||||
t.Fatalf("got %d logs, want 1", len(logs))
|
||||
}
|
||||
if logs[0] != "wg: [v2] pass" {
|
||||
t.Errorf("got %q, want \"wg: [v2] pass\"", logs[0])
|
||||
}
|
||||
}
|
||||
|
||||
func stringer(s string) stringerString {
|
||||
return stringerString(s)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user