【发布时间】:2015-11-27 03:58:30
【问题描述】:
我正在努力解决 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 的调试/跟踪日志记录,但目前日志中没有任何有趣的内容。
有什么想法吗?
【问题讨论】:
-
也许你在写重复的点?如果测量名称、标签集和时间戳匹配,则新点会静默覆盖先前的点。此外,它可能是版本不匹配。 InfluxDB API 最近发生了关于整数的重大更改,并且该插件可能尚未更新以处理该问题。 InfluxDB 日志是否显示失败的写入?