diff --git a/fluentd/Dockerfile b/fluentd/Dockerfile index 545af56..2f1e645 100644 --- a/fluentd/Dockerfile +++ b/fluentd/Dockerfile @@ -3,6 +3,7 @@ USER root RUN apt-get update \ && apt-get -y install --no-install-recommends wget \ && rm -rf /var/lib/apt/lists/* +RUN gem install fluent-plugin-rewrite-tag-filter RUN gem install gelf RUN cd /fluentd/plugins \ && wget -q https://raw.githubusercontent.com/emsearcy/fluent-plugin-gelf/master/lib/fluent/plugin/out_gelf.rb diff --git a/fluentd/fluent.conf b/fluentd/fluent.conf index 14832d9..5c6a474 100644 --- a/fluentd/fluent.conf +++ b/fluentd/fluent.conf @@ -20,13 +20,25 @@ - @type file - path /var/log/hostlogs/containers/${tag} - append true - - timekey 5s - flush_mode immediate - + @type copy + + @type file + path /var/log/hostlogs/containers/${tag} + pos_file /var/log/hostlogs/httpd/access_log.pos + append true + + timekey 5s + flush_mode immediate + + + + @type rewrite_tag_filter + + key container_name + pattern /(.+)/ + tag ${tag}.$1 + +