|
| 1 | +# syslog-utils |
| 2 | + |
| 3 | +Simple syslog RFC3164 and RFC5424 command-line client & server. |
| 4 | + |
| 5 | +The client supports UDP, TCP and TLS transports and is useful to test syslog |
| 6 | +servers or simply to send syslog messages. The server supports TCP and TLS and |
| 7 | +will simply print any parsed messages to stdout. |
| 8 | + |
| 9 | + |
| 10 | +## Getting Started |
| 11 | + |
| 12 | +The easiest way to get started is by using the statically compiled release |
| 13 | +binaries or the docker image. Download the *syslog-client* and *syslog-server* |
| 14 | +binaries from the [latest release](/koenw/syslog-utils/releases) page. |
| 15 | + |
| 16 | +Run the client with `docker run ghcr.io/koenw/syslog-utils syslog-client` or |
| 17 | +the server with `docker run ghcr.io/koenw/syslog-utils syslog-server`. |
| 18 | + |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | + |
| 23 | +### syslog-client |
| 24 | + |
| 25 | +Simple command line syslog client to send RFC5424 or RFC3164 messages over UDP, |
| 26 | +TCP or TLS. |
| 27 | + |
| 28 | + |
| 29 | +#### Help |
| 30 | + |
| 31 | +```sh |
| 32 | +❯ syslog-client --help |
| 33 | +syslog-client 0.1.0 |
| 34 | +Syslog client for diagnostic purposes |
| 35 | + |
| 36 | +USAGE: |
| 37 | + syslog-client [FLAGS] [OPTIONS] <transport> [messages]... |
| 38 | + |
| 39 | +FLAGS: |
| 40 | + --accept-invalid-certs Accept invalid TLS certificates (insecure!) |
| 41 | + --accept-invalid-hostnames Accept TLS certificates for invalid hostnames (insecure!) |
| 42 | + -h, --help Prints help information |
| 43 | + --stdin Read log messages from stdin |
| 44 | + -V, --version Prints version information |
| 45 | + |
| 46 | +OPTIONS: |
| 47 | + --format <format> Either rfc5424 or rfc3164 [default: rfc3164] |
| 48 | + --host <host> Syslog server host [default: localhost] |
| 49 | + --msg-id <msg-id> RFC5424 message id, e.g. "TCPIN" |
| 50 | + --port <port> |
| 51 | + Syslog server port [default: 514(UDP), 601(TCP) or 6514(TLS)] |
| 52 | + |
| 53 | + --sd-elements <sd-elements> |
| 54 | + RFC5424 Structured Data Elements, e.g. "key=value,anotherkey=anothervalue" |
| 55 | + |
| 56 | + --sd-id <sd-id> |
| 57 | + RFC5424 SD-ID (Structured Data ID) [default: syslog-client@1234] |
| 58 | + |
| 59 | + --severity <severity> Message severity [default: notice] |
| 60 | + --tls-domain <tls-domain> Syslog server TLS domain [default: syslog server host] |
| 61 | + |
| 62 | +ARGS: |
| 63 | + <transport> Syslog transport protocol [possible values: tcp, udp, |
| 64 | + tls] |
| 65 | + <messages>... Log messages to send |
| 66 | +``` |
| 67 | + |
| 68 | + |
| 69 | +#### Examples |
| 70 | + |
| 71 | +| Command | Description | |
| 72 | +| --- | --- | |
| 73 | +| `syslog-client tcp --port 5014 --format rfc5424 --sd-elements="key=value,nothing=equal" hello` | Send the message "hello" to port 5014, with RFC5424 Structured Data | |
| 74 | +| `syslog-client tls --host syslog.example.com --stdin` | Read messages on stdin and send them over TLS to syslog.example.com | |
| 75 | +| `syslog-client tls --accept-invalid-certs hello` | Send messages over TLS, ignoring certificate errors | |
| 76 | + |
| 77 | + |
| 78 | +### syslog-server |
| 79 | + |
| 80 | + |
| 81 | +#### Help |
| 82 | + |
| 83 | +```sh |
| 84 | +❯ syslog-server --help |
| 85 | +syslog-server 0.1.0 |
| 86 | +Simple Syslog server for testing & development |
| 87 | + |
| 88 | +Currently TCP and TLS transports are supported, UDP might be added in the future. Received |
| 89 | +messages will be logged to stdout. Set the environmental variable variable `SYSLOG_SERVER_LOG` |
| 90 | +to one of the values (from quiet to verbose) `error`, `warn`, `info`, `debug` or `trace` to log |
| 91 | +more or less information. |
| 92 | + |
| 93 | +USAGE: |
| 94 | + syslog-server [OPTIONS] <transport> |
| 95 | + |
| 96 | +FLAGS: |
| 97 | + -h, --help |
| 98 | + Prints help information |
| 99 | + |
| 100 | + -V, --version |
| 101 | + Prints version information |
| 102 | + |
| 103 | + |
| 104 | +OPTIONS: |
| 105 | + --address <address> |
| 106 | + Address to listen on [default: [::]] |
| 107 | + |
| 108 | + --cert <certificate> |
| 109 | + Path to file containing TLS certificate |
| 110 | + |
| 111 | + --port <port> |
| 112 | + Port to listen on [default: 514] |
| 113 | + |
| 114 | + --key <private-key> |
| 115 | + Path to file containing TLS private key |
| 116 | + |
| 117 | + |
| 118 | +ARGS: |
| 119 | + <transport> |
| 120 | + Syslog Protocol to accept [possible values: tcp, udp, tls] |
| 121 | +``` |
| 122 | +
|
| 123 | +
|
| 124 | +#### Examples |
| 125 | +
|
| 126 | +| Command | Description | |
| 127 | +| --- | --- | |
| 128 | +| `syslog-server tls --cert cert.pem --key.pem --port 5014` | Listen for TLS connections on port 5014 using the given key & certificate | |
| 129 | +| `SYSLOG_SERVER_LOG=debug syslog-server tcp --port 5014` | Listen for TCP connection on port 5014, being extra verbose about it | |
| 130 | +
|
| 131 | +
|
| 132 | +## Development |
| 133 | +
|
| 134 | +Run `nix develop` for a development shell. |
| 135 | +
|
| 136 | +| Command | Description | |
| 137 | +| --- | --- | |
| 138 | +| `nix develop` | Development shell including all dependencies | |
| 139 | +| `nix build '.#docker' && docker load <result` | Build and load a docker image | |
| 140 | +| `nix build '.#static'` | Build static (musl) binaries | |
| 141 | +| `nix build '.#native'` | Build dynamically linked binaries | |
| 142 | +| `just gen-selfsigned-cert` | Generate a self-signed certificate for use with the TLS server | |
0 commit comments