1/配置
<source>
type tailformat apache
path /Data/logs/nginx/access.log
pos_file /var/log/td-agent/nginx.pos
tag nginx.access
</source>
pos_file建议设置,方便fluentd挂掉以后,继续传递,确保数据完整性
<match nginx.access.**>
type copy
<store>
type file
path /var/log/fluentd/access_log
</store>
<store>
type webhdfs
host hadoop-host
port 50070
path /tmp/logs/nginx.%Y%m%d_%H.${hostname}.log
flush_interval 10s
</store>
</match>
2/启动
td-agent -o /var/log/td-agent/td-agent.log --daemon /var/log/fluentd/fluentd.pid