有什么方法可以使用logstash配置文件来按比例缩放具有不同类型/索引的输出?
例如
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "index_resources"
if(%{some_field_id}==kb){
document_type => "document_type"
document_id => "%{some_id}"
}
else {
document_type => "other_document_type"
document_id => "%{some_other_id}"
}
}
最佳答案
是的,您可以将文档路由到logstash
本身中的多个索引。 Output
可能看起来像这样:
output {
stdout {codec => rubydebug}
if %{some_field_id} == "kb" { <---- insert your condition here
elasticsearch {
host => "localhost"
protocol => "http"
index => "index1"
document_type => "document_type"
document_id => "%{some_id}"
}
} else {
elasticsearch {
host => "localhost"
protocol => "http"
index => "index2"
document_type => "other_document_type"
document_id => "%{some_other_id}"
}
}
}
这个thread也可能对您有帮助。
关于elasticsearch - 基于输入的logstash Elasticsearch 输出配置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41012303/