用于从多个couchdb数据库导入数据的Config文件Logstash

时间:2015-08-21 19:11:08

标签: node.js elasticsearch couchdb logstash

我们将数据类型存储在couchdb的每个数据库中。配置文件将从多个数据库导入数据的格式是什么?或者我是否需要多个配置文件才能将数据从每个数据库导入索引。将不胜感激任何帮助。

感谢。

1 个答案:

答案 0 :(得分:0)

我们为多个数据库使用单个配置文件。

它不完美,但现在功能正常。

目前看起来像:

input { 
  couchdb_changes {
    sequence_path => "db1.seq"
    db => "db1"
    host => "xxx.xxx.xxx.xxx"
    username => "xxx"
    password => "xxx"
    add_field => {
       "organization" => "db1"
    }
  }
  couchdb_changes {
    sequence_path => "db2.seq"
    db => "db2"
    host => "xxx.xxx.xxx.xxx"
    username => "xxx"
    password => "xxx"
    add_field => {
       "organization" => "db2"
    }
  }
} 

filter {
  mutate {
    remove_field => [ "_attachments" ]
  }
}

output { 
  stdout { codec => rubydebug } 

  elasticsearch { 
    cluster => "cluster0"
    host => ["xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"] 
    protocol => "http" 
    index => "%{[organization]}" 
    document_id => "%{[@metadata][_id]}"
  } 
}