forked from cedbossneo/fluentd-sidecar-es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (35 loc) · 2.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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
# Elasticsearch.
# 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".
# This configuration assumes that the cluster this pod is running in has an
# Elasticsearch instance reachable via a service named elasticsearch-logging.
FROM ubuntu:14.04
# Ensure there are enough file descriptors for running Fluentd.
RUN ulimit -n 65536
# Disable prompts from apt.
ENV DEBIAN_FRONTEND noninteractive
# Install the standard, official Fluentd agent (called td-agent, for the
# project's parent company, Treasure Data).
RUN apt-get -q update && \
apt-get install -y curl && \
apt-get install -y -q libcurl4-openssl-dev make build-essential && \
apt-get clean
RUN /usr/bin/curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
# Change the default user and group to root. Needed to ensure Fluentd can access
# files anywhere in the filesystem that it's requested to.
RUN sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent
# Install the Elasticsearch Fluentd plug-in.
RUN /usr/sbin/td-agent-gem install fluent-plugin-elasticsearch fluent-plugin-kubernetes_metadata_filter
# 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 Elasticsearch.
COPY td-agent.conf /etc/td-agent/td-agent.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 && exec /usr/sbin/td-agent --use-v1-config --no-supervisor