Commit 34bee126 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Refina config, reescribe tags de eventos

Instala plugin para lograr la reescritura de los tags.
parent 50a8c0c0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4,11 +4,14 @@ FROM fluent/fluentd:v${FLUENTD_VERSION}

LABEL maintainer="info@redmic.es"

ARG REWRITE_TAG_PLUGIN_VERSION=2.1.1
ARG ES_PLUGIN_VERSION=2.12.1

RUN apk add --update --no-cache --virtual .build-deps \
		build-base \
		ruby-dev && \
	gem install --no-document fluent-plugin-elasticsearch:${ES_PLUGIN_VERSION} && \
	gem install --no-document \
		fluent-plugin-rewrite-tag-filter:${REWRITE_TAG_PLUGIN_VERSION} \
		fluent-plugin-elasticsearch:${ES_PLUGIN_VERSION} && \
	gem sources --clear-all && \
	apk del .build-deps
+16 −5
Original line number Diff line number Diff line
<source>
	@type forward
	port 24224
	bind 0.0.0.0
</source>
<match *.**>

<match **>
	@type copy
	<store>
		@type rewrite_tag_filter
		<rule>
			key container_name
			pattern /^\/?([\w-]+)\.(\d+)\.(.*)/
			tag $1
		</rule>
	</store>
	<store>
		@type elasticsearch
		@id elasticsearch-output
		@log_level debug
		hosts "#{ENV['ES_HOSTS']}"
		type_name fluentd
		logstash_format true
		logstash_prefix fluentd
		logstash_dateformat %Y%m%d
		include_tag_key true
		tag_key @log_name
		flush_interval 1s
		tag_key @service_name
		flush_interval 5s
	</store>
	<store>
		@type stdout
		@id standard-output
		@log_level warn
	</store>
</match>