你能帮忙写一个脚本,在运行这个脚本时出现以下错误
input {
# We read from the "old" cluster
elasticsearch {
hosts => [ "localhost" ]
port => "9200"
index => "products"
size => 500
scroll => "5m"
docinfo => true
}
}
output {
# We write to the "new" cluster
elasticsearch {
host => "localhost"
port => "9200"
protocol => "http"
index => "%{[@metadata][_index1]}"
index_type => "%{[@metadata][_type1]}"
document_id => "%{[@metadata][_id]}"
}
# We print dots to see it in action
stdout {
codec => "dots"
}
}
这是我的logstash.conf文件,当我运行它时出现以下错误
未知设置elasticsearch的“端口”
{:level=>:error}
fetched an invalid config {:config=>"input {\n # We read from the \"old\" cluster\n elasticsearch {\n hosts => [ \"localhost\" ]\n port => \"9200\"\n index => \"products\"\n size => 500\n scroll => \"5m\"\n docinfo => true\n }\n}\n\noutput {\n # We write to the \"new\" cluster\n elasticsearch {\n host => \"localhost\"\n port => \"9200\"\n protocol => \"http\"\n index => \"%{[@metadata][_index1]}\"\n index_type => \"%{[@metadata][_type1]}\"\n document_id => \"%{[@metadata][_id]}\"\n }\n # We print dots to see it in action\n stdout {\n codec => \"dots\"\n }\
答案 0 :(得分:0)
我已使用2+版本的选项修改了配置。
input {
# We read from the "old" cluster
elasticsearch {
hosts => [ "localhost:9200" ]
index => "products"
size => 500
scroll => "5m"
docinfo => true
}
}
output {
# We write to the "new" cluster
elasticsearch {
hosts => [ "localhost:9200" ]
index => "%{[@metadata][_index1]}"
document_type => "%{[@metadata][_type1]}"
document_id => "%{[@metadata][_id]}"
}
# We print dots to see it in action
stdout {
codec => "dots"
}
}