From b4c7dfa6745cb637f96c4f94eba00cd4d29cac9d Mon Sep 17 00:00:00 2001 From: Mik Vyatskov Date: Wed, 2 Nov 2016 12:08:36 +0100 Subject: [PATCH] Switched from google-fluentd to configuring fluentd from scratch --- .../fluentd-gcp/fluentd-gcp-image/Dockerfile | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/cluster/addons/fluentd-gcp/fluentd-gcp-image/Dockerfile b/cluster/addons/fluentd-gcp/fluentd-gcp-image/Dockerfile index f2244a57bd9..59316c69729 100644 --- a/cluster/addons/fluentd-gcp/fluentd-gcp-image/Dockerfile +++ b/cluster/addons/fluentd-gcp/fluentd-gcp-image/Dockerfile @@ -21,36 +21,38 @@ # in the Google Developer Console. FROM gcr.io/google_containers/ubuntu-slim:0.4 -MAINTAINER Alex Robinson "arob@google.com" -# Disable prompts from apt. +MAINTAINER Mik Vyatskov "vmik@google.com" + +# Disable prompts from apt ENV DEBIAN_FRONTEND noninteractive -# Keeps unneeded configs from being installed along with fluentd. -ENV DO_NOT_INSTALL_CATCH_ALL_CONFIG true -RUN apt-get -q update && \ - apt-get install -y curl ca-certificates gcc make bash && \ - apt-get install -y --reinstall lsb-base lsb-release && \ - echo "Installing logging agent" && \ - curl -sSL https://dl.google.com/cloudagents/install-logging-agent.sh | bash && \ - /usr/sbin/google-fluentd-gem install fluent-plugin-record-reformer -v 0.8.1 && \ - /usr/sbin/google-fluentd-gem install fluent-plugin-systemd -v 0.0.3 && \ - apt-get remove -y gcc make && \ - apt-get autoremove -y && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - /opt/google-fluentd/embedded/share/doc \ - /opt/google-fluentd/embedded/share/gtk-doc \ - /opt/google-fluentd/embedded/lib/postgresql \ - /opt/google-fluentd/embedded/bin/postgres \ - /opt/google-fluentd/embedded/share/postgresql \ - /var/log/google-fluentd +# Install build tools +RUN apt-get -qq update && \ + apt-get install -y -qq curl ca-certificates gcc make bash sudo && \ + apt-get install -y -qq --reinstall lsb-base lsb-release + +# Install logging agent and required gems +RUN /usr/bin/curl -sSL https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent2.sh | sh && \ + sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent && \ + td-agent-gem install --no-document fluent-plugin-record-reformer -v 0.8.2 && \ + td-agent-gem install --no-document fluent-plugin-systemd -v 0.0.5 && \ + td-agent-gem install --no-document fluent-plugin-google-cloud -v 0.5.2 + +# Remove build tools +RUN apt-get remove -y -qq gcc make && \ + apt-get autoremove -y -qq && \ + apt-get clean -qq + +# Remove unnecessary files +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Copy the Fluentd configuration files for logging Docker container logs. # Either configuration file can be used by specifying `-c ` as a command # line argument. -COPY google-fluentd.conf /etc/google-fluentd/google-fluentd.conf -COPY google-fluentd-journal.conf /etc/google-fluentd/google-fluentd-journal.conf +RUN rm /etc/td-agent/td-agent.conf +COPY google-fluentd.conf /etc/td-agent/google-fluentd.conf +COPY google-fluentd-journal.conf /etc/td-agent/google-fluentd-journal.conf # Start Fluentd to pick up our config that watches Docker container logs. -CMD /usr/sbin/google-fluentd "$FLUENTD_ARGS" +CMD /usr/sbin/td-agent "$FLUENTD_ARGS" \ No newline at end of file