到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 –