Browse Source

add fluentd

master
zeus 3 years ago
parent
commit
7e5f2d5a6b
  1. 114
      WriteToMongo/fluent/fluent.conf
  2. 1
      docker-compose.yml

114
WriteToMongo/fluent/fluent.conf

@ -1,50 +1,108 @@
# config
<match debug.*>
@type stdout
</match>
# input log
<source> <source>
@type forward @type tail
port 24224
bind 0.0.0.0 path /var/log/*.log
path_key tailed_path
tag stats.node
# parse json
<parse>
@type json
</parse>
pos_file /tmp/fluentd--1605454018.pos
</source> </source>
<filter mongo.redis>
@type record_transformer
<record>
gen_host "#{Socket.gethostname}"
</record>
</filter> # input stats
<source>
@type tail
<filter mongo.*> path /var/log-in/*/*
@type record_transformer path_key tailed_path
<record>
tag ${tag}
</record>
</filter>
tag log.node
<match mongo.*> # parse none
<parse>
@type none
</parse>
pos_file /tmp/fluentd--1605454014.pos
</source>
# output mongo log*
<match log.*>
@type copy @type copy
<store> <store>
@type stdout #@type mongo_replset
</store>
<store>
@type mongo @type mongo
host mongo #database app_swarmlab
port 27017
database fluentdb database fluentdb
#collection logs
collection test collection test
#nodes swarmlabmongo1:27017,swarmlabmongo2:27017,swarmlabmongo1:27017
nodes mongo.poc-datacollector_datacollector-net:27017
#user app_swarmlab
#password app_swarmlab
#replica_set rs0
num_retries 60
capped capped
capped_size 1024m capped_size 100m
<buffer> <buffer>
flush_interval 10s flush_interval 20s
</buffer> </buffer>
</store>
<store>
@type stdout
</store>
<format> <store>
@type json @type file
</format> path /tmp/mylog
<buffer>
timekey 1d
timekey_use_utc true
timekey_wait 10s
</buffer>
</store> </store>
# interval
</match>
# output mongo stats*
<match stats.*>
@type copy
<store>
@type mongo_replset
database app_swarmlab
collection logs
nodes swarmlabmongo1:27017,swarmlabmongo2:27017,swarmlabmongo1:27017
user swarmlab
password swarmlab
replica_set rs0
num_retries 60
capped
capped_size 100m
</store>
<store>
@type stdout
</store>
</match> </match>

1
docker-compose.yml

@ -66,6 +66,7 @@ services:
# - "3001:3001" # - "3001:3001"
volumes: volumes:
- ./dummyservice/swarmlab-app/src/run/:/home/node/dummyservice/dummyservice/swarmlab-app/src/run/ - ./dummyservice/swarmlab-app/src/run/:/home/node/dummyservice/dummyservice/swarmlab-app/src/run/
- ./WriteToMongo/fluent/fluent.conf:/fluentd/etc/fluent.conf
#links: #links:
# - mongo # - mongo
networks: networks:

Loading…
Cancel
Save