moby/daemon/logger
Cory Snider 01915a725e daemon/logger: follow LogFile without file watches
File watches have been a source of complexity and unreliability in the
LogFile follow implementation, especially when combined with file
rotation. File change events can be unreliably delivered, especially on
Windows, and the polling fallback adds latency. Following across
rotations has never worked reliably on Windows. Without synchronization
between the log writer and readers, race conditions abound: readers can
read from the file while a log entry is only partially written, leading
to decode errors and necessitating retries.

In addition to the complexities stemming from file watches, the LogFile
follow implementation had complexity from needing to handle file
truncations, and (due to a now-fixed bug in the polling file watcher
implementation) evictions to unlock the log file so it could be rotated.
Log files are now always rotated, never truncated, so these situations
no longer need to be handled by the follow code.

Rewrite the LogFile follow implementation in terms of waiting until
LogFile notifies it that a new message has been written to the log file.
The LogFile informs the follower of the file offset of the last complete
write so that the follower knows not to read past that, preventing it
from attempting to decode partial messages and making retries
unnecessary. Synchronization between LogFile and its followers is used
at critical points to prevent missed notifications of writes and races
between file rotations and the follower opening files for read.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-05-19 15:22:22 -04:00
..
awslogs test: use T.Setenv to set env vars in tests 2022-04-23 17:44:16 +08:00
etwlogs panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
fluentd panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
gcplogs panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
gelf panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
journald daemon/logger: remove ProducerGone from LogWatcher 2022-05-19 15:22:22 -04:00
jsonfilelog daemon/logger: follow LogFile without file watches 2022-05-19 15:22:22 -04:00
local daemon/logger: fix refcounting decompressed files 2022-05-19 15:22:22 -04:00
logentries panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
loggertest daemon/logger: fix refcounting decompressed files 2022-05-19 15:22:22 -04:00
loggerutils daemon/logger: follow LogFile without file watches 2022-05-19 15:22:22 -04:00
splunk test: use T.Setenv to set env vars in tests 2022-04-23 17:44:16 +08:00
syslog panic() instead of logrus.Fatal() in init funcs 2022-04-21 12:15:20 +02:00
templates staticcheck: ignore "SA1019: strings.Title is deprecated" 2022-03-16 12:11:54 +01:00
adapter.go Adds PartialLogMetadata to encode protobuf for logger plugins 2019-04-09 16:14:33 +05:00
adapter_test.go daemon/logger: remove ProducerGone from LogWatcher 2022-05-19 15:22:22 -04:00
copier.go Limit the rate at which logger errors are logged into daemon logs 2021-05-24 16:41:38 -07:00
copier_test.go Handle long log messages correctly on SizedLogger 2021-01-20 16:44:06 -08:00
factory.go Improve error feedback when plugin does not implement desired interface 2020-04-21 18:06:24 -03:00
log_cache_opts.go Support configuration of log cacher. 2020-02-19 17:02:34 -05:00
logger.go daemon/logger: remove ProducerGone from LogWatcher 2022-05-19 15:22:22 -04:00
logger_error.go Limit the rate at which logger errors are logged into daemon logs 2021-05-24 16:41:38 -07:00
logger_test.go Improve partial message support in logger 2018-04-11 13:26:28 -07:00
loginfo.go Check the length of the correct variable #42039 2021-02-18 10:27:35 -06:00
metrics.go goimports: fix imports 2019-09-18 12:56:54 +02:00
plugin.go Entropy cannot be saved 2019-06-07 11:54:45 +01:00
plugin_unix.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
plugin_unsupported.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
proxy.go Add canonical import comment 2018-02-05 16:51:57 -05:00
ring.go Merge pull request #42291 from angelcar/awslogs-dont-log-messge-discarded-errors 2021-05-27 19:33:44 -07:00
ring_test.go Update documentation for RingLogger's ring buffer 2018-05-16 18:52:50 -06:00