From 4ddc4e786a22687470611dbd97bc7406187807ae Mon Sep 17 00:00:00 2001 From: Jonathan Short Date: Fri, 5 Sep 2014 17:10:39 -0400 Subject: [PATCH] initial commit --- 50-default.conf | 7 +++++++ Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 7 ++++++- run.sh | 17 +++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 50-default.conf create mode 100644 Dockerfile create mode 100755 run.sh diff --git a/50-default.conf b/50-default.conf new file mode 100644 index 0000000..ead8818 --- /dev/null +++ b/50-default.conf @@ -0,0 +1,7 @@ +$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [TOKEN@41058 tag=\"TAG\"] %msg%\n" + +*.* @@logs-01.loggly.com:514;LogglyFormat + +$ModLoad imudp +$UDPServerRun 514 + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fae3ee6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +################################################################# +# +# ## . +# ## ## ## == +# ## ## ## ## === +# /""""""""""""""""\___/ === +# ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ +# \______ o __/ +# \ \ __/ +# \____\______/ +# +################################################################# + +FROM ubuntu:trusty +MAINTAINER Jonathan Short + +RUN apt-get update +RUN apt-get -y dist-upgrade + +ADD run.sh /tmp/run.sh +ADD 50-default.conf /etc/rsyslog.d/50-default.conf + +EXPOSE 514 + +CMD ["/tmp/run.sh"] + diff --git a/README.md b/README.md index fa46640..c1f2da5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ loggly-docker ============= -Docker container for loggly (via syslog) +Docker container for loggly (via rsyslog) + +Usage: + +docker run -e TOKEN= -e TAG= sendgridlabs/loggly-docker + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..7bb54dc --- /dev/null +++ b/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -z "$TOKEN" ]; then + echo "Missing \$TOKEN" + exit 1 +fi + +if [ -z "$TAG" ]; then + echo "Missing \$TAG" + exit 1 +fi + +sed -i "s/TOKEN/$TOKEN/" /etc/rsyslog.d/50-default.conf +sed -i "s/TAG/$TAG/" /etc/rsyslog.d/50-default.conf + +exec /usr/sbin/rsyslogd -n +