summaryrefslogtreecommitdiffhomepage
path: root/types/logger
AgeCommit message (Collapse)AuthorFilesLines
2021-05-05types/logger: add key grinder stats lines to rate-limiting exemption listJosh Bleecher Snyder1-2/+6
Updates #1749 Co-authored-by: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-04types/logger: fix rate limiter allowlistJosh Bleecher Snyder1-1/+1
Upstream wireguard-go renamed the interface method from CreateEndpoint to ParseEndpoint. I updated the log call site but not the allowlist. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-04-30types/logger: rate limited: more hysteresis, better messages.Avery Pennarun3-39/+142
- Switch to our own simpler token bucket, since x/time/rate is missing necessary stuff (can't provide your own time func; can't check the current bucket contents) and it's overkill anyway. - Add tests that actually include advancing time. - Don't remove the rate limit on a message until there's enough room to print at least two more of them. When we do, we'll also print how many we dropped, as a contextual reminder that some were previously lost. (This is more like how the Linux kernel does it.) - Reformat the [RATE LIMITED] messages to be shorter, and to not corrupt original message. Instead, we print the message, then print its format string. - Use %q instead of \"%s\", for more accurate parsing later, if the format string contained quotes. Fixes #1772 Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-01-28types/logger: fix rateFree interaction with verbosity prefixesJosh Bleecher Snyder1-4/+4
We log lines like this: c.logf("[v1] magicsock: disco: %v->%v (%v, %v) sent %v", c.discoShort, dstDisco.ShortString(), dstKey.ShortString(), derpStr(dst.String()), disco.MessageSummary(m)) The leading [v1] causes it to get unintentionally rate limited. Until we have a proper fix, work around it. Fixes #1216 Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-01-19types/logger: trim spaces from the rate-limited example message.David Anderson1-1/+1
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-01-15wgengine/magicsock: close test loggers once we're done with themJosh Bleecher Snyder1-0/+24
This is a big hammer approach to helping with #1132. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-01-13Provide example when format string is rate limitedSmitty2-3/+3
Here's an example log line in the new format: [RATE LIMITED] format string "open-conn-track: timeout opening %v; no associated peer node" (example: "open-conn-track: timeout opening ([ip] => [ip]); no associated peer node") This should make debugging logging issues a bit easier, and give more context as to why something was rate limited. This change was proposed in a comment on #1110. Signed-off-by: Smitty <me@smitop.com>
2021-01-08wgengine: quiet some wireguard-go loggingJosh Bleecher Snyder1-0/+13
The log lines that wireguard-go prints as it starts and stops its worker routines are mostly noise. They also happen after other work is completed, which causes failures in some of the log testing packages. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-12-19Clarify that raw format strings are intentionalSmitty2-3/+3
This caused some confusion in issue #460, since usually raw format strings aren't printed directly. Hopefully by directly logging that they are intended to be raw format strings, this will be more clear. Rate limited format strings now look like: [RATE LIMITED] format string "control: sendStatus: %s: %v" Closes #460. Signed-off-by: Smitty <me@smitop.com>
2020-11-11all: prepare for GOOS=ios in Go 1.16Brad Fitzpatrick1-1/+1
Work with either way for now on iOS (darwin/arm64 vs ios/arm64). In February when Go 1.16 comes out we'll have a universal binary for darwin/arm64 (macOS) and will drop support for Go 1.15 and its darwin/amd64 meaning iOS. (it'll mean macOS). Context: * https://tip.golang.org/doc/go1.16#darwin * https://github.com/golang/go/issues/38485 * https://github.com/golang/go/issues/42100
2020-10-29types/logger: fix LogOnChange to pass through format/args to underlying loggerBrad Fitzpatrick1-1/+4
So they don't get interpretted as a format pattern or get rate-limited away in the wrong way.
2020-10-19types/logger: move RusagePrefixLog to logger package, disable by defaultBrad Fitzpatrick3-0/+63
The RusagePrefixLog is rarely useful, hasn't been useful in a long time, is rarely the measurement we need, and is pretty spammy (and syscall-heavy). Disable it by default. We can enable it when we're debugging memory.
2020-07-14types/logger: fix go test vet errorElias Naur1-1/+1
Silences types/logger/logger_test.go:63:30: conversion from int to string yields a string of one rune Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-03types/logger: add rateFreePrefix rate-limiting-exempt log format prefixesBrad Fitzpatrick1-0/+14
Per conversation with @danderson.
2020-06-15Fix concurrency issues in controlclient, ipn, types/logger (#456)Dmytro Shynkevych2-1/+35
Signed-Off-By: Dmytro Shynkevych <dmytro@tailscale.com>
2020-05-29types/logger: add TS_DEBUG_LOG_RATE knob to easily turn off rate limitingBrad Fitzpatrick1-0/+6
2020-05-20log rate limiting: reformat limiter messages, and use nonempty burst size.Avery Pennarun2-8/+10
- Reformat the warning about a message being rate limited to print the format string, rather than the formatted message. This helps give a clue what "type" of message is being limited. - Change the rate limit warning to be [RATE LIMITED] in all caps. This uses less space on each line, plus is more noticeable. - In tailscaled, change the frequency to be less often (once every 5 seconds per format string) but to allow bursts of up to 5 messages. This greatly reduces the number of messages that are rate limited during startup, but allows us to tighten the limit even further during normal runtime. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2020-05-15wgengine: log node IDs when peers are added/removed (#381)Wendi Yu2-18/+80
Also stop logging data sent/received from nodes we're not connected to (ie all those `x`s being logged in the `peers: ` line) Signed-off-by: Wendi <wendi.yu@yahoo.ca>
2020-05-13types/logger: add ArgWriterBrad Fitzpatrick2-0/+31
2020-05-11types/logger: simplify mutex locking in rate-limited loggerBrad Fitzpatrick1-31/+42
Updates #365 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-05-09types/logger: fix deadlock in the burst case.David Anderson2-3/+4
Fixes #365. Signed-off-by: David Anderson <danderson@tailscale.com>
2020-05-08Implement rate limiting on log messages (#356)Wendi Yu2-0/+100
Implement rate limiting on log messages Addresses issue #317, where logs can get spammed with the same message nonstop. Created a rate limiting closure on logging functions, which limits the number of messages being logged per second based on format string. To keep memory usage as constant as possible, the previous cache purging at periodic time intervals has been replaced by an LRU that discards the oldest string when the capacity of the cache is reached. Signed-off-by: Wendi Yu <wendi.yu@yahoo.ca>
2020-04-11all: remove unnecessary trailing newlines in format patterns for consistencyBrad Fitzpatrick1-0/+1
And document on logger.Logf that it's unnecessary.
2020-04-06types/logger: add Discard helper.David Anderson1-0/+3
2020-03-06types/logger: add adapters for Logf to std Logger/WriterBrad Fitzpatrick2-0/+43
2020-02-25types/logger: add WithPrefix, use it in two placesBrad Fitzpatrick1-1/+9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-14Move "logger" package to under types, now that we have it.Brad Fitzpatrick1-0/+10
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>