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/klogd-linux/log/run | 2 +- examples/klogd-linux/run | 2 +- examples/s6-svscanboot | 16 ++++++++-------- examples/syslogd-linux/README | 9 --------- examples/syslogd-linux/log/README | 9 --------- examples/syslogd-linux/log/env/LOGSCRIPT | 6 ------ examples/syslogd-linux/log/notification-fd | 1 - examples/syslogd-linux/log/run | 8 -------- examples/syslogd-linux/notification-fd | 1 - examples/syslogd-linux/run | 8 -------- 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 ++++ 17 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 examples/syslogd-linux/README delete mode 100644 examples/syslogd-linux/log/README delete mode 100644 examples/syslogd-linux/log/env/LOGSCRIPT delete mode 100644 examples/syslogd-linux/log/notification-fd delete mode 100755 examples/syslogd-linux/log/run delete mode 100644 examples/syslogd-linux/notification-fd delete mode 100755 examples/syslogd-linux/run 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') diff --git a/examples/klogd-linux/log/run b/examples/klogd-linux/log/run index 458fe27..82a3bb6 100755 --- a/examples/klogd-linux/log/run +++ b/examples/klogd-linux/log/run @@ -1,4 +1,4 @@ -#!/command/execlineb -P +#!/bin/execlineb -P s6-setuidgid klog exec -c s6-log -d3 t s1000000 n20 /var/log/klogd diff --git a/examples/klogd-linux/run b/examples/klogd-linux/run index 453b55b..ae9935a 100755 --- a/examples/klogd-linux/run +++ b/examples/klogd-linux/run @@ -1,4 +1,4 @@ -#!/command/execlineb -P +#!/bin/execlineb -P fdmove -c 2 1 redirfd -r 0 /proc/kmsg exec -c diff --git a/examples/s6-svscanboot b/examples/s6-svscanboot index 6bac3a2..be4bea4 100755 --- a/examples/s6-svscanboot +++ b/examples/s6-svscanboot @@ -1,9 +1,9 @@ -#!/command/execlineb -P +#!/bin/execlineb -P -/command/exec -c -/command/s6-setsid -qb -/command/redirfd -r 0 /dev/null -/command/redirfd -wnb 1 /service/s6-svscan-log/fifo -/command/fdmove -c 2 1 -/command/exec -a s6-svscan -/command/s6-svscan -t0 /service +/bin/exec -c +/bin/s6-setsid -qb +/bin/redirfd -r 0 /dev/null +/bin/redirfd -wnb 1 /service/s6-svscan-log/fifo +/bin/fdmove -c 2 1 +/bin/exec -a s6-svscan +/bin/s6-svscan -t0 /service diff --git a/examples/syslogd-linux/README b/examples/syslogd-linux/README deleted file mode 100644 index 675715b..0000000 --- a/examples/syslogd-linux/README +++ /dev/null @@ -1,9 +0,0 @@ -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. -It needs a Unix superserver (see s6-networking, ucspi-unix or -ucspi-ipc) and ucspilogd. -A ucspilogd process is spawned for every syslog() client. It -processes logs and sends them to stderr, i.e. the service's -logger. diff --git a/examples/syslogd-linux/log/README b/examples/syslogd-linux/log/README deleted file mode 100644 index 9d4968e..0000000 --- a/examples/syslogd-linux/log/README +++ /dev/null @@ -1,9 +0,0 @@ - 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-linux/log/env/LOGSCRIPT b/examples/syslogd-linux/log/env/LOGSCRIPT deleted file mode 100644 index e7a1eb7..0000000 --- a/examples/syslogd-linux/log/env/LOGSCRIPT +++ /dev/null @@ -1,6 +0,0 @@ -- +^[0-9]+:\s[0-9]+:\serror\. t /var/log/syslogd/error -- +^[0-9]+:\s[0-9]+:\sauthpriv\. t /var/log/syslogd/auth -- +^[0-9]+:\s[0-9]+:\suser\. t /var/log/syslogd/user -- +^[0-9]+:\s[0-9]+:\smessages\. t /var/log/syslogd/messages -- +^[0-9]+:\s[0-9]+:\sdaemon\. t /var/log/syslogd/daemon -f t /var/log/syslogd/misc diff --git a/examples/syslogd-linux/log/notification-fd b/examples/syslogd-linux/log/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/examples/syslogd-linux/log/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/examples/syslogd-linux/log/run b/examples/syslogd-linux/log/run deleted file mode 100755 index fcb667c..0000000 --- a/examples/syslogd-linux/log/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/command/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-linux/notification-fd b/examples/syslogd-linux/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/examples/syslogd-linux/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/examples/syslogd-linux/run b/examples/syslogd-linux/run deleted file mode 100755 index de33c2c..0000000 --- a/examples/syslogd-linux/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -exec -c -s6-envuidgid nobody -fdmove 1 3 -s6-ipcserver -U -1 -- /dev/log -fdmove -c 1 2 -ucspilogd IPCREMOTEEUID IPCREMOTEEGID 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