From 7e5f2d5a6bbc83053376a57f0dafeadf75b8a5f2 Mon Sep 17 00:00:00 2001 From: zeus Date: Sun, 21 Nov 2021 19:21:35 +0200 Subject: [PATCH] add fluentd --- WriteToMongo/fluent/fluent.conf | 126 +++++++++++++++++++++++--------- docker-compose.yml | 1 + 2 files changed, 93 insertions(+), 34 deletions(-) diff --git a/WriteToMongo/fluent/fluent.conf b/WriteToMongo/fluent/fluent.conf index 54b5592..4a06fe1 100644 --- a/WriteToMongo/fluent/fluent.conf +++ b/WriteToMongo/fluent/fluent.conf @@ -1,50 +1,108 @@ +# config + + @type stdout + + +# input log - @type forward - port 24224 - bind 0.0.0.0 + @type tail + + path /var/log/*.log + path_key tailed_path + + tag stats.node + + # parse json + + @type json + + + pos_file /tmp/fluentd--1605454018.pos - - @type record_transformer - - gen_host "#{Socket.gethostname}" - - - - - @type record_transformer - - tag ${tag} - - +# input stats + + @type tail + + path /var/log-in/*/* + path_key tailed_path + + tag log.node + + # parse none + + @type none + + + pos_file /tmp/fluentd--1605454014.pos + - +# output mongo log* + @type copy - @type stdout + #@type mongo_replset + @type mongo + + #database app_swarmlab + database fluentdb + #collection logs + 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_size 100m + + + + flush_interval 20s + - @type mongo + @type stdout + - host mongo - port 27017 + + @type file + path /tmp/mylog + + timekey 1d + timekey_use_utc true + timekey_wait 10s + + - database fluentdb - collection test - capped - capped_size 1024m + - - flush_interval 10s - - - - @type json - +# output mongo stats* + + @type copy + + @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 + + + @type stdout - # interval - + diff --git a/docker-compose.yml b/docker-compose.yml index 7f9fca1..208c34a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,6 +66,7 @@ services: # - "3001:3001" volumes: - ./dummyservice/swarmlab-app/src/run/:/home/node/dummyservice/dummyservice/swarmlab-app/src/run/ + - ./WriteToMongo/fluent/fluent.conf:/fluentd/etc/fluent.conf #links: # - mongo networks: