From 678508409a92f80cacd94a70e1e51ca4a389435a Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 18 Aug 2021 18:46:40 +0000 Subject: Add s6-socklog Signed-off-by: Laurent Bercot --- examples/syslogd/README | 4 ++++ examples/syslogd/log/README | 9 +++++++++ examples/syslogd/log/env/LOGSCRIPT | 6 ++++++ examples/syslogd/log/notification-fd | 1 + examples/syslogd/log/run | 8 ++++++++ examples/syslogd/notification-fd | 1 + examples/syslogd/run | 4 ++++ 7 files changed, 33 insertions(+) create mode 100644 examples/syslogd/README create mode 100644 examples/syslogd/log/README create mode 100644 examples/syslogd/log/env/LOGSCRIPT create mode 100644 examples/syslogd/log/notification-fd create mode 100755 examples/syslogd/log/run create mode 100644 examples/syslogd/notification-fd create mode 100755 examples/syslogd/run (limited to 'examples/syslogd') diff --git a/examples/syslogd/README b/examples/syslogd/README new file mode 100644 index 0000000..c115a4e --- /dev/null +++ b/examples/syslogd/README @@ -0,0 +1,4 @@ +This is an example of a service directory for process supervision by s6. + +This syslogd emulation works on any Unix where syslog() is +implemented via a connection on the /dev/log Unix-domain socket. diff --git a/examples/syslogd/log/README b/examples/syslogd/log/README new file mode 100644 index 0000000..9d4968e --- /dev/null +++ b/examples/syslogd/log/README @@ -0,0 +1,9 @@ + This logger service logs everything the syslogd service receives +into subdirectories of /var/log/syslogd/ logdir. + + The script provided in env/LOGSCRIPT emulates the default +syslogd behaviour on a majority of Linux distributions. + + Note that spaces cannot be used as is in the LOGSCRIPT file, +because they are delimiters for the splitting of $LOGSCRIPT +in the run script. So \s is used instead. diff --git a/examples/syslogd/log/env/LOGSCRIPT b/examples/syslogd/log/env/LOGSCRIPT new file mode 100644 index 0000000..35ae234 --- /dev/null +++ b/examples/syslogd/log/env/LOGSCRIPT @@ -0,0 +1,6 @@ +- +^\\serror\\. t /var/log/syslogd/error +- +^\\sauthpriv\\. t /var/log/syslogd/auth +- +^\\suser\\. t /var/log/syslogd/user +- +^\\smessages\\. t /var/log/syslogd/messages +- +^\\sdaemon\\. t /var/log/syslogd/daemon +f t /var/log/syslogd/misc diff --git a/examples/syslogd/log/notification-fd b/examples/syslogd/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/syslogd/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/syslogd/log/run b/examples/syslogd/log/run new file mode 100755 index 0000000..c066f37 --- /dev/null +++ b/examples/syslogd/log/run @@ -0,0 +1,8 @@ +#!/bun/execlineb -P +s6-setuidgid syslog +s6-envdir -f env +importas -Cs LOGSCRIPT LOGSCRIPT +exec -c +s6-log -d3 -- $LOGSCRIPT + +# Change env/LOGSCRIPT to alter s6-log's behaviour diff --git a/examples/syslogd/notification-fd b/examples/syslogd/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/syslogd/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/syslogd/run b/examples/syslogd/run new file mode 100755 index 0000000..98a52d9 --- /dev/null +++ b/examples/syslogd/run @@ -0,0 +1,4 @@ +#!/bin/execlineb -P +fdmove -c 2 1 +s6-envuidgid nobody +s6-socklog -d3 -U -t3000 -- cgit v1.2.3