[logbufpipe]
logbufpipe records data from its stdin, immediately forwards it to stdout,
and stores the data in an in-memory queue. when this queue is full, old data
is dropped so that new data can be added. You can connect to logbufpipe
through a unix socket to see the stored data and receive live updates:
# server: capture data and store it
(echo hi; sleep 5; echo goodbye) | logbufpipe 1M /tmp/lbp1
# client: connect to the server and show the output
logbufpipe utf8 1M /tmp/lbp1
In server mode, logbufpipe will open a unix socket at the given path
and keep the specified amount of data in memory. This limit is expressed as
a number n, optionally followed by one of K, M, G, or T, representing n bytes,
1024n bytes for K, 1024²n bytes for M, 1024³n bytes for G, or 1024⁴ bytes for T.
As a client, logbufpipe has multiple modes:
- raw/bytes: output the newest bytes and live data. may output half of a char.
- utf8: same as raw, but skip bytes until a valid utf8 char is encountered.
The size limit does not have to match that of the server. The smaller of the
two limits decides how much old data can be shown. If the path is a normal file
instead of a unix socket, acts as if the server had sent the data in the file.