Browse Source

edit fluent

master
zeus 3 years ago
parent
commit
44af49cc15
  1. 98
      WriteToMongo/fluent/fluent.conf

98
WriteToMongo/fluent/fluent.conf

@ -9,70 +9,83 @@
path /var/log/*.log path /var/log/*.log
path_key tailed_path path_key tailed_path
pos_file /tmp/fluentd--1605454018.pos
pos_file_compaction_interval 30s
refresh_interval 30s
skip_refresh_on_startup
tag stats.node tag stats.node
# parse json enable_stat_watcher false
enable_watch_timer false
read_from_head true
follow_inodes true # Without this parameter, file rotation causes log duplication
<parse> <parse>
@type json @type none
</parse>
pos_file /tmp/fluentd--1605454018.pos keep_time_key true
</parse>
</source> </source>
# input stats # input stats
<source> <source>
@type tail @type tail
path /var/log-in/*/* path /var/log-in/*/*
path_key tailed_path path_key tailed_path
pos_file /tmp/fluentd--1605454014.pos
pos_file_compaction_interval 10s
refresh_interval 30s
skip_refresh_on_startup
tag log.node tag log.node
# parse none enable_stat_watcher false
enable_watch_timer false
read_from_head true
follow_inodes true # Without this parameter, file rotation causes log duplication
<parse> <parse>
@type none @type none
</parse>
pos_file /tmp/fluentd--1605454014.pos keep_time_key true
</parse>
</source> </source>
# output mongo log* # output mongo log*
<match log.*> <match log.*>
@type copy @type copy
<store> copy_mode deep
#@type mongo_replset <store ignore_error>
@type mongo @type mongo
#database app_swarmlab connection_string mongodb://mongo.poc-datacollector_datacollector-net:27017/fluentdb
database fluentdb
#collection logs
collection test
#nodes swarmlabmongo1:27017,swarmlabmongo2:27017,swarmlabmongo1:27017
host mongo.poc-datacollector_datacollector-net
port 27017
#user app_swarmlab #database fluentdb
#password app_swarmlab collection test
#host mongo.poc-datacollector_datacollector-net
#port 27017
#replica_set rs0
num_retries 60 num_retries 60
capped capped
capped_size 100m capped_size 100m
<inject>
# key name of timestamp
time_key time
</inject>
<buffer> <buffer>
flush_interval 20s retry_wait 50s
flush_mode immediate
#flush_interval 10s
</buffer> </buffer>
</store> </store>
<store> <store ignore_error>
@type stdout @type stdout
</store> </store>
<store> <store ignore_error>
@type file @type file
path /tmp/mylog path /tmp/mylog
<buffer> <buffer>
@ -82,29 +95,42 @@
</buffer> </buffer>
</store> </store>
</match> </match>
# output mongo stats* # output mongo log*
<match stats.*> <match stats.*>
@type copy @type copy
<store> <store>
@type mongo_replset @type mongo
#copy_mode shallow
database app_swarmlab
collection logs
nodes swarmlabmongo1:27017,swarmlabmongo2:27017,swarmlabmongo1:27017
user swarmlab database fluentdb
password swarmlab collection stats
host mongo.poc-datacollector_datacollector-net
port 27017
replica_set rs0
num_retries 60 num_retries 60
capped capped
capped_size 100m capped_size 100m
<buffer>
flush_interval 30s
</buffer>
</store> </store>
<store> <store>
@type stdout @type stdout
</store> </store>
</match>
<store>
@type file
path /tmp/mylog
<buffer>
timekey 1d
timekey_use_utc true
timekey_wait 10s
</buffer>
</store>
</match>

Loading…
Cancel
Save