2015-04-22 00:37:44 +00:00
|
|
|
# This Dockerfile will build an image that is configured to use Fluentd to
|
|
|
|
# collect container log files from the specified paths and send them to the
|
|
|
|
# Google Cloud Logging API.
|
|
|
|
# The environment variable that controls which log files are collected is
|
|
|
|
# FILES_TO_COLLECT. Files specified in the environment variable should be
|
|
|
|
# separated by whitespace, as in "/var/log/syslog /var/log/nginx/access.log".
|
2015-04-23 22:07:05 +00:00
|
|
|
# This configuration assumes that the host performing the collection is a VM
|
2015-04-22 00:37:44 +00:00
|
|
|
# that has been created with a logging.write scope and that the Logging API
|
|
|
|
# has been enabled for the project in the Google Developer Console.
|
|
|
|
|
|
|
|
FROM ubuntu:14.04
|
|
|
|
MAINTAINER Alex Robinson "arob@google.com"
|
|
|
|
|
|
|
|
# Disable prompts from apt.
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
|
|
|
# Install the Fluentd agent that knows how to send logs to Google Cloud Logging.
|
|
|
|
RUN apt-get -q update && \
|
2015-04-27 20:47:38 +00:00
|
|
|
apt-get install -y curl && \
|
2015-04-22 00:37:44 +00:00
|
|
|
apt-get clean && \
|
|
|
|
curl -s https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh | sudo bash
|
|
|
|
|
2015-05-19 23:42:49 +00:00
|
|
|
# Update gem for fluent-plugin-google-cloud
|
|
|
|
RUN /usr/sbin/google-fluentd-gem update fluent-plugin-google-cloud
|
|
|
|
|
2015-04-22 00:37:44 +00:00
|
|
|
# Copy the configuration file generator for creating input configurations for
|
|
|
|
# each file specified in the FILES_TO_COLLECT environment variable.
|
|
|
|
COPY config_generator.sh /usr/local/sbin/config_generator.sh
|
|
|
|
|
|
|
|
# Copy the Fluentd configuration file for collecting from all the inputs
|
|
|
|
# generated by the config generator and sending them to Google Cloud Logging.
|
|
|
|
COPY google-fluentd.conf /etc/google-fluentd/google-fluentd.conf
|
|
|
|
|
|
|
|
# Run the config generator to get the config files in place and start Fluentd.
|
|
|
|
# We have to run the config generator at runtime rather than now so that it can
|
|
|
|
# incorporate the files provided in the environment variable in its config.
|
|
|
|
CMD /usr/local/sbin/config_generator.sh && /usr/sbin/google-fluentd -qq --use-v1-config --suppress-repeated-stacktrace > /var/log/google-fluentd/google-fluentd.log
|