s6-linux-utils
Software
skarnet.org
The s6-logwatch program
s6-logwatch watches the current file of a logdir, printing it
in real time.
Interface
s6-logwatch [ -m buflen ] logdir
- s6-logwatch prints logdir/current and watches
the file.
- logdir must be managed by a
s6-log instance.
- When new logs are appended to the current file, s6-logwatch prints
them in real-time to stdout.
- When a rotation happens, s6-logwatch notices, and keeps watching the
new current file.
- s6-logwatch runs forever until killed.
Options
- -m buflen : accumulate at most buflen
bytes into the stdout buffer before flushing it. By default, buflen is
4000.
Bugs
- s6-logwatch is not entirely reliable because there is an unavoidable
race condition when a rotation occurs; it's a hack for humans to keep reading
logs across rotations, not a tool to be used in safe programming. When the
race condition is triggered, s6-logwatch will be unable to understand what
state logdir is in and will exit 101 with an error message.
- Specific support in the logger program would be needed to avoid this
race condition; it would significantly bloat the logger program, so it has
not been deemed useful.
Notes
- s6-logwatch is Linux-specific because it uses the
inotify interface.