From fe024b3f3fb7acff22e880f6b077c3e02d94fd41 Mon Sep 17 00:00:00 2001 From: Matt Knox Date: Mon, 20 Jun 2016 10:26:40 -0600 Subject: [PATCH] feat(fluentd): adding sumologic plugin support This PR adds support for shipping collected logs from fluentd to sumologic. It is configured with a single SUMOLOGIC_COLLECTOR_URL env var added to the DaemonSet --- rootfs/Dockerfile | 1 + rootfs/opt/fluentd/sbin/boot | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index d53e0b4..28c2a42 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update \ && fluent-gem install --no-document fluent-plugin-kubernetes_metadata_filter \ && fluent-gem install --no-document fluent-plugin-elasticsearch \ && fluent-gem install --no-document fluent-plugin-remote_syslog -v 0.3.2 \ + && fluent-gem install --no-document fluent-plugin-sumologic-mattk42 \ && fluent-gem install --no-document influxdb -v 0.3.2 \ && fluent-gem install --no-document nsq-ruby \ && fluent-gem install --local /opt/fluentd/deis-output/pkg/fluent-plugin-deis_output-0.1.0.gem \ diff --git a/rootfs/opt/fluentd/sbin/boot b/rootfs/opt/fluentd/sbin/boot index 5217604..081f4ed 100755 --- a/rootfs/opt/fluentd/sbin/boot +++ b/rootfs/opt/fluentd/sbin/boot @@ -198,6 +198,31 @@ cat << EOF >> $FLUENTD_CONF EOF fi +if [ -n "$SUMOLOGIC_COLLECTOR_URL" ] +then +IS_HTTPS=`echo "$SUMOLOGIC_COLLECTOR_URL" | grep -c 'https://'` +SUMOLOGIC_HOST=`echo "$SUMOLOGIC_COLLECTOR_URL" | sed 's/https*:\/\///' | cut -d '/' -f 1` +SUMOLOGIC_ENDPOINT=`echo "$SUMOLOGIC_COLLECTOR_URL" | sed "s/.*:\/\/$SUMOLOGIC_HOST//"` + +SUMOLOGIC_PORT=443 +if [ $IS_HTTPS != 1 ] +then + SUMOLOGIC_PORT=80 +fi + +cat << EOF >> $FLUENTD_CONF + + buffer_type file + buffer_path /var/log/fluent/logcentral + type sumologic + host $SUMOLOGIC_HOST + port $SUMOLOGIC_PORT + format json + path $SUMOLOGIC_ENDPOINT + +EOF +fi + cat << EOF >> $FLUENTD_CONF @type deis