Switched from google-fluentd to configuring fluentd from scratch

This commit is contained in:
Mik Vyatskov 2016-11-02 12:08:36 +01:00
parent 24361fce06
commit b4c7dfa674

View File

@ -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 <file>` 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"