我有一个redis db,logstash和两个elasticsearch一个influxdb。我正在将关键字从redis转移到elasticsearch,它工作得很好,并且想测试influxdb,它根本不能工作。
有没有人有一个有效的influxdb连接器,或者我应该如何在redis中提供数据来使它工作?
这是我的influx-db连接,它只会引发错误
influxdb {
host => "localhost"
measurement => "sensor1"
allow_time_override => true
use_event_fields_for_data_points => true
exclude_fields => ["@version", "@timestamp", "sequence", "type", "host"]
}
这是我的redis连接,工作正常
redis
{
host => "localhost"
data_type => "list"
key => "vortex"
threads => 4
type => "testrecord"
codec => "plain"
}
我试过这种线条格式
"sensor1,measure=1 1489594615.9747“作为redis的列表,例如
key: vortex
values:
sensor1,measure=1 1489594615.9747
sensor1,measure=1 1489594615.9747
sensor1,measure=1 1489594615.9747
sensor1,measure=1 1489594615.9747
sensor1,measure=1 1489594615.9747
....
但这也不起作用。
有没有人知道如何通过logstash从redis获取数据到influxdb?
发布于 2017-03-16 19:08:17
在寻找了几个小时后,我用以下方法解决了这个问题:
对于logstash文件夹,首先进入已安装版本的influxdb插件,例如,C:\tools\logstash-5.2.2\vendor\bundle\jruby\1.9\gems\logstash-output-influxdb-4.0.0\lib\logstash\outputs
默认:retention_policy的保留策略: use
- in redis i used the following string format (without timestamp) foo=70617 bar=3
- the configfile for logsash is shown below - just as a sample of how to do it so it finally works :-)
input {
redis{
host => "localhost"
data_type => "list"
key => "vortex"
threads => 4
type => "testrecord"
codec => "plain"
}
}
filter {
kv {
add_field => {
"test1" => "yellow=cat"
"test=space" => "making= life=hard"
"feild= space" => "pink= dog"
}
}
}
output {
stdout { codec => rubydebug }
influxdb {
host => "localhost"
measurement => "myseries"
allow_time_override => true
use_event_fields_for_data_points => true
exclude_fields => ["@version", "@timestamp", "sequence", "message", "type", "host"]
send_as_tags => ["bar", "baz", "test1", "test=space"]
}
}
https://stackoverflow.com/questions/42815396
复制相似问题