Commit 480db3ed authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Cambia reescritura de tag por filtro ampliador

En lugar de cambiar los tags de los eventos, se toma la primera parte de
los mismos (el separador es '.'), descartando el resto (replica e id
del job). Requiere cambiar el tag por defecto creado por Docker, para
que contenga el nombre completo del contenedor (y no su id acortado).

Elimina plugin de reescritura, ya que no se usa.
parent 34bee126
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -4,14 +4,12 @@ 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-rewrite-tag-filter:${REWRITE_TAG_PLUGIN_VERSION} \
		fluent-plugin-elasticsearch:${ES_PLUGIN_VERSION} && \
	gem sources --clear-all && \
	apk del .build-deps
+7 −10
Original line number Diff line number Diff line
@@ -2,16 +2,15 @@
	@type forward
</source>

<filter **>
	@type record_transformer
	<record>
		@service_name ${tag_parts[0]}
	</record>
</filter>

<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
@@ -21,8 +20,6 @@
		logstash_format true
		logstash_prefix fluentd
		logstash_dateformat %Y%m%d
		include_tag_key true
		tag_key @service_name
		flush_interval 5s
	</store>
	<store>