繁体   English   中英

基于输入的logstash弹性搜索输出配置

[英]logstash elastic search output configuration based on inputs

有什么方法可以使用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}"   
        }
    }
}

线程也可能对您有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM