【发布时间】:2016-12-19 20:38:51
【问题描述】:
你能帮忙写一个脚本吗,我在运行这个脚本时遇到以下错误
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 文件,当我运行这个 m 时出现以下错误
弹性搜索的未知设置“端口”
{: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 }\
【问题讨论】:
-
如果你使用 Logstash 2+,port 和 index_type 选项不再有效
-
是的,我正在使用 2.X 版本的日志存储,现在应该做什么。
-
能否告诉我 2.X 版本的正确格式?