Skip to content

Commit

Permalink
Use socketee to relay syslog messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmer committed Oct 17, 2018
1 parent 06ffa58 commit 89d43d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Expand Up @@ -26,4 +26,7 @@ COPY receive-mail discourse-smtp-fast-rejection /usr/local/bin/
COPY lib/ /usr/local/lib/ruby/site_ruby/
COPY boot /sbin/

ADD https://github.com/mpalmer/socketee/releases/download/v0.0.2/socketee /usr/local/bin/
RUN chmod 0755 /usr/local/bin/socketee

CMD ["/sbin/boot"]
9 changes: 3 additions & 6 deletions README.md
Expand Up @@ -51,12 +51,9 @@ out-of-the-box syslog integration, this container runs a tiny script which
reads all syslog data and dumps it to the container's `stderr` (which is
then examinable by `docker logs`).

If, by some chance, you have a system which can inject itself into a
container and process syslog entries intelligently (such as, say,
[syslogstash](https://github.com/discourse/syslogstash)), you can set the
`SYSLOG_SOCKET` environment variable to an alternate path, and the
`/dev/log` syslog socket will be symlinked to that alternate path.

If, by some chance, you want to process your Postfix logs more extensively,
you can set `SOCKETEE_RELAY_SOCKET` and all syslog messages will also be
sent to that socket for further processing.


# Theory of Operation
Expand Down
8 changes: 4 additions & 4 deletions boot
Expand Up @@ -2,12 +2,12 @@

set -e

# First, fire up possibly the world's *worst* syslog server, unless there's
# somewhere else meaningful to send syslog data to
if [ -z "$SYSLOG_SOCKET" ]; then
# Send syslog messages to stderr, optionally relaying them to another socket
# for postfix-exporter to take a look at
if [ -z "$SOCKETEE_RELAY_SOCKET" ]; then
/usr/bin/socat UNIX-RECV:/dev/log,mode=0666 stderr &
else
ln -sf "$SYSLOG_SOCKET" /dev/log
/usr/local/bin/socketee /dev/log "$SOCKETEE_RELAY_SOCKET" &
fi

echo "Operating environment:" >&2
Expand Down

0 comments on commit 89d43d0

Please sign in to comment.