kolla/docker/fluentd/Dockerfile.j2
Jeffrey Zhang cc543ab7c4 Fix the read mariadb log permission issue for fluentd
mariadb.log mode is 660, which can not be read by fluentd. Add td-agent
user into mysql group to allow fluent to read the log.

Closes-Bug: #1664867
Change-Id: If624002909d5fcd0bb82a5bc9937945518ec84b9
2017-02-15 16:03:09 +08:00

45 lines
1.3 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% block fluentd_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='td-agent', groups='mysql') }}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set fluentd_packages = [
'td-agent',
'gcc-c++',
'make'
] %}
{% elif base_distro in ['ubuntu', 'debian'] %}
{% set fluentd_packages = [
'td-agent',
'make',
'g++'
] %}
{% endif %}
{{ macros.install_packages(fluentd_packages | customizable("packages")) }}
RUN ulimit -n 65536 \
&& 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 fluent-plugin-parser fluent-plugin-kubernetes_metadata_filter fluent-plugin-elasticsearch fluent-plugin-grep fluent-plugin-grok-parser fluent-plugin-rewrite-tag-filter \
&& rm -f /etc/td-agent/td-agent.conf
COPY fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
&& chmod 755 /usr/local/bin/kolla_extend_start \
&& chown -R td-agent: /etc/td-agent
{% block fluentd_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER td-agent