#zstd #tcp #read-line #tcp-connection #incoming-connection #fdlinecombine

app tcplinecombine

Simple CLI tool to collect incoming lines from TCP clients and compress them (without interleaving bytes within lines)

1 unstable release

0.1.0 Mar 5, 2023

#8 in #incoming-connection

MIT/Apache

8KB
84 lines

tcplinecombine

Privitive logging server that accepts incoming line-based messages and stores them to one compressed file.

host1$ tcplinecombine 0.0.0.0:1234 output.zstd -i 5
host1: ...

host2$ date | nc 192.168.0.1 1234
^C
host2$ date | nc 192.168.0.1 1234
^C

host1:
Incoming connection from 127.0.0.1:44750
  finished serving 127.0.0.1:44750
Incoming connection from 127.0.0.1:44762
  finished serving 127.0.0.1:44762
^C (after waiting for 5 seconds)
host1$ zstdcat output.zstd
Sun Mar  5 21:05:05 CET 2023
Sun Mar  5 21:05:07 CET 2023
output.zstd : Read error (39) : premature end

Features

  • Handling multiple simultaneous connections and interleaving incoming lines (but not bytes).
  • zstd compression of output file with periodical flushes

Installation

Download a pre-built executable from Github releases or install from source code with cargo install --path . or cargo install tcplinecombine.

CLI options

tcplinecombine --help output
ARGS:
    <listenaddr>

    <outputfile>

OPTIONS:
    -i, --flush-interval <seconds>

    -l, --max-line-length <bytes>

    -h, --help
      Prints help information.

See also

Dependencies

~7–19MB
~210K SLoC