"loc-6ren">
gpt4 book ai didi

elasticsearch - 无法使用logstash将couchdb数据发送到elasticsearch

转载 作者:行者123 更新时间:2023-12-02 23:28:28 25 4
gpt4 key购买 nike

嗨,我一直在尝试将数据从ouchdb推送到elasticsearch,这是代码

input { 
couchdb_changes {
db => "users"
host => "localhost"
port => "5984"
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "playtym"
}
}

最佳答案

您可以粘贴logstash日志吗?这样我们可以更好地帮助您。

无论如何,我要粘贴我用来复制沙发到 flex 的配置。

我在nginx后面使用沙发。 Logstash与 flex 服务器在同一台服务器上。

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

关于elasticsearch - 无法使用logstash将couchdb数据发送到elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39703255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com