https://github.com/cooolinx/tinysyslog
6.2K
A tiny and simple syslog server with log rotation. tinysyslog was born out of the need for a tiny (the binary is currently ~10MB in size), easy to setup and use syslog server that simply writes every incoming log (automatic detect RFC5424/RFC3164/RFC6587 format) to a file (or to stdout for Docker) that is automatically rotated. tinysyslog is based on go-syslog and lumberjack.
Supported log formats:
(see go-syslog/format tests for details)
Run:
docker run --rm --name tinysyslog -p 5140:5140/udp -d cooolin/tinysyslog
Send a log:
# udp for RFC5424
nc -w0 -u 127.0.0.1 5140 <<< '<165>1 2016-01-01T12:01:21Z hostname appname 1234 ID47 [exampleSDID@32473 iut="9" eventSource="test" eventID="123"] message'
# tcp for RFC3164
nc -w0 127.0.0.1 5140 <<< '<7>2022-12-01T18:49:08+08:00 ColinM1Pro.local app.wum.app[38277]: message'
Confirm the container received it:
docker logs tinysyslog
time="2018-11-15T19:40:22Z" level=info msg="tinysyslog listening on 0.0.0.0:5140"
Jan 1 12:01:21 hostname appname[1234]: message
Usage of ./tinysyslogd:
--address string IP and port to listen on. (default "127.0.0.1:5140")
--format string Which log format will use: RFC5424, RFC3164, RFC6587. (default: auto)
--filter string Filter to filter logs with. Valid filters are: null and regex. Null doesn't do any filtering. (default "null")
--filter-grok-fields strings Grok fields to keep.
--filter-grok-pattern string Grok pattern to filter with.
--filter-regex string Regex to filter with.
--log-file string The log file to write to. 'stdout' means log to stdout and 'stderr' means log to stderr. (default "stdout")
--log-format string The log format. Valid format values are: text, json. (default "text")
--log-level string The granularity of log outputs. Valid level names are: debug, info, warning, error and critical. (default "info")
--mutator string Mutator type to use. Valid mutators are: text, json. (default "text")
--sink-console-output string Console to output too. Valid outputs are: stdout, stderr. (default "stdout")
--sink-elasticsearch-address string Elasticsearch server address. (default "http://127.0.0.1:9200")
--sink-elasticsearch-index-name string Elasticsearch index name. (default "tinysyslog")
--sink-filesystem-filename string File to write incoming logs to. (default "syslog.log")
--sink-filesystem-max-age int Maximum age (in days) before a log is deleted. (default 30)
--sink-filesystem-max-backups int Maximum backups to keep. (default 10)
--sink-filesystem-max-size int Maximum log size (in megabytes) before it's rotated. (default 100)
--sinks strings Sinks to save syslogs to. Valid sinks are: console, elasticsearch and filesystem. (default [console])
--socket-type string Type of socket to use, TCP or UDP. If no type is specified, both are used.
Nothing scientific here but with a simple client consisting of a for loop sending large messages as fast as possible over UDP:
iostat -d 5
KB/t tps MB/s
127.61 585 72.95
127.66 592 73.74
126.41 591 72.98
126.36 590 72.76
124.76 615 74.95
Content type
Image
Digest
sha256:a8975f809…
Size
4.6 MB
Last updated
almost 4 years ago
docker pull cooolin/tinysyslog