【问题标题】:redis - logstash - influxdb datatransferredis - logstash - influxdb 数据传输
【发布时间】:2017-03-15 16:22:09
【问题描述】:

我有一个 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吗?

【问题讨论】:

    标签: redis logstash influxdb


    【解决方案1】:

    搜索了几个小时后,我通过以下方式解决了它:

    • 第一步进入logstash文件夹中安装的influxdb插件版本,例如C:\tools\logstash-5.2.2\vendor\bundle\jruby\1.9\gems\logstash-output-influxdb-4.0.0\lib\logstash\outputs
    • 搜索文件 influxdb.rb(应该是文件夹内唯一的文件)
    • 替换保留政策

      要使用的保留政策

    • config :retention_policy, :validate => :string, :default => "autogen"

    • //config :retention_policy, :validate => :string, :default => "default"

      • 在redis中我使用了以下字符串格式(没有时间戳) foo=70617 bar=3

      • logsash 的配置文件如下所示 - 只是作为如何执行此操作的示例,因此它最终可以工作:-)

    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"]
    		}
          }
    			
    			
    		

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多