fluentd-docker-image
fluentd-docker-image copied to clipboard
input tail plugin: tail file and pos fle are not exsits, when creating tail file, need restart td-agent?
I am trying use tail plugin to record log to mongo, but when starting td-agent(using docker), the log file is not exists and the pos file also does not been created. when i write record to log file, fluentd seems does not work. I run fluentd -c /fluentd/etc/fluent.conf -p /fluentd/plugins/ again, the fluentd does work.
here is my fluentd.conf:
<label @aiosplannet>
<match **>
@type mongo
host 192.168.0.125
port 27017
database fluentd
collection logs
# for capped collection
capped
capped_size 1024m
<buffer>
# flush
flush_interval 10s
</buffer>
</match>
<match **>
@type file
@id output2
path /fluentd/log/aios/data.*.log
symlink_path /fluentd/log/aios/data.log
append true
time_slice_format %Y%m%d
time_slice_wait 10m
time_format %Y%m%dT%H%M%S%z
</match>
</label>
<source>
@type tail
@id input2
tag @aiosplannet
path /aios-data/logs/*
exclude_path ["/aios-data/logs/api.log"]
pos_file /aios-data/logs/log.pos
refresh_interval 60s
<parse>
@type regexp
expression ^(?<timestamp>[^\|]*)\s\|\s(?<level>\S+)\s(?<module>\S+)\s(?<hostname>\S+)\s(?<threadId>\S+)\s(?<user>\S+)\s(?<message>.*)$
</parse>
@label @aiosplannet
</source>
I need to run docker exec -ti fluentd sh -c "fluentd -c /fluentd/etc/fluent.conf -p /fluentd/plugins/" even when the container already runnig.