到elasticsearch你可以粘贴logstash日志?所以我们可以帮助你更好。
无论如何,我粘贴我的配置,我正在使用复制我的沙发弹性。
我在nginx背后使用沙发。 logstash位于弹性相同的服务器上。
input {
couchdb_changes {
type => "foo"
db => "database"
host => "couch.example.com"
username => "user"
password => "pass"
initial_sequence => 0
secure => true
port => 443
}
}
filter {
if [type] == "foo" {
if "delete" in [@metadata][action] {
mutate { add_field => { "[@metadata][my_action]" => "delete" } }
}
else {
mutate { add_field => { "[@metadata][my_action]" => "index" } }
}
if [doc] {
ruby {
code => '
event["doc"].each{ |k,v| event["#{k}"] = v }
'
}
}
# 6)
if [doc] {
mutate { remove_field => [ "[doc]" ] }
}
if [doc_as_upsert] {
mutate { remove_field => [ "[doc_as_upsert]" ] }
}
if [@version] {
mutate { remove_field => [ "[@version]" ] }
}
}
}
output {
if [type] == "foo" {
elasticsearch {
index => "%{[ClassName]}" #ClassName is a doc field that I am using to organize the index and document_type
document_type => "%{[ClassName]}"
document_id => "%{[@metadata][_id]}"
action => "%{[@metadata][my_action]}"
doc_as_upsert => "true"
}
}
}
我的配置是基于这样的: https://github.com/gammaliu/couchdb-logstash-elasticsearch
会发生什么?请更详细地描述你的问题。 – Val
我已将上述代码放在“/opt/logstash/couch.conf”中,并运行命令“$ bin/logstash -f couch.conf”。在运行命令时,管道正在创建,但是当couchdb中发生更改时,它不会将数据推送到elasticsearch –