Add fluentd support

This commit is contained in:
Aleksander Cynarski 2018-11-28 18:31:14 +01:00
parent c360e96f22
commit 10559e7980
5 changed files with 73 additions and 0 deletions

View File

@ -40,5 +40,29 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
fluentd:
build: ./fluentd
container_name: exen-fluentd
volumes:
- ./fluentd/conf:/fluentd/etc
links:
- "exen-influxdb"
ports:
- 24224:24224
environment:
SERVICE_24224_NAME: 'fluentd'
SERVICE_5140_NAME: 'fluentd'
influxdb:
image: influxdb:latest
container_name: exen-influxdb
volumes:
- ./influxdb/data:/var/lib/influxdb
environment:
INFLUXDB_DATA_ENGINE: 'tsm1'
INFLUXDB_REPORTING_DISABLED: 'false'
SERVICE_8086_NAME: 'influxdb'
volumes:
portainer_data:

26
fluent.conf Normal file
View File

@ -0,0 +1,26 @@
<source>
@type forward
@id input1
@label @mainstream
port ${LISTEN_PORT}
source_hostname_key hostname
</source>
<label @mainstream>
<filter **>
@type record_transformer
<record>
tag ${tag}
hostname ${hostname}
</record>
</filter>
<match **>
type influxdb
host ${DB_HOST}
port ${DB_PORT}
dbname ${DB_NAME}
collection ${DB_COLLECTION}
flush_interval ${FLUSH_INTERVAL}
</match>
</label>

3
fluentd/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM fluent/fluentd:latest
RUN ["gem", "install", "fluent-plugin-influxdb", "--no-rdoc", "--no-ri"]

20
fluentd/conf/fluent.conf Normal file
View File

@ -0,0 +1,20 @@
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match *.**>
@type copy
<store>
@type influxdb
host exen-influxdb
dbname logging
port 8086
tag_key @log_name
flush_interval 1s
</store>
<store>
@type stdout
</store>
</match>

0
plugins/.gitkeep Normal file
View File