我正在努力解决 fluentd 和 influxdb 之间的数据丢失问题。
将 fluent-plugin-influxdb 插件与此配置一起使用:
<source>
id test_syslog
type syslog
port 42185
protocol_type tcp
time_format %Y-%m-%dT%H:%M:%SZ
tag test_syslog
format /^(?<time>[^ ]*) (?<fastly_server>[^ ]*) (?<log_name>[^ ]*) (?<host>[^ ]*) ([^ ]*) ([^ ]*) (?<http_method>[^ ]*) (?<http_request>[^ ]*) (?<http_status>[^ ]*) (?<cache_status>[^ ]*) (?<uuid>[^ ]*) *(?<device_model>.*)$/
</source>
<match test_syslog.**>
type copy
<store>
type file
path /var/log/td-agent/test_syslog
</store>
<store>
id test_syslog
type influxdb
dbname test1
flush_interval 10s
host localhost
port 8086
remove_tag_suffix .local0.info
</store>
</match>
在比较文件输出和 influxdb 中的数据时,我发现:
user@ip-xxx-xxx-xxx-xxx:/var/log/td-agent# curl -G 'http://localhost:8086/query' --data-urlencode "db=test1" --data-urlencode "q=SELECT COUNT(host) FROM log_data" ; cat test_syslog.20150901.b51eb4653c54c63e7 | wc -l
{"results":[{"series":[{"name":"log_data","columns":["time","count"],"values":[["1970-01-01T00:00:00Z",582]]}]}]}2355
日志中有 2355 行,但数据库中只有 582 条记录。
我已经启用了来自 influxdb 和 fluentd 的调试/跟踪日志记录,但到目前为止日志中没有什么有趣的。
有任何想法吗?