美文网首页
logstash-过滤ES数据到新的ES

logstash-过滤ES数据到新的ES

作者: 觉释 | 来源:发表于2020-08-11 14:31 被阅读0次
    ###类型ZB
    input{
      elasticsearch {
        hosts => "10.10.x.x:9200"
        index => "index"
        query => '{"query":{"bool":{"must":[{"range":{"optime":{"gt":"1","lt":"100"}}}],"must_not":[],"should":[]}},"from":0,"sort":[],"aggs":{}}'
        docinfo => true
        }
    }
    filter{
            if [@metadata][_type] != "ZB" {
            drop{}
      }
    }
    output{
            elasticsearch{
                    hosts => "10.10.0.0:9200"
                    index => "index2"
                    #document_type => "ZB"
                    document_id => "%{id}"
                    codec => json_lines
            }
            stdout{
                    codec => json_lines
            }
    
    }
    
    ##RFID
    
    input{
      elasticsearch {
        hosts => "10.10.x.x:9200"
        index => "index_*"
        query => '{"query":{"bool":{"must":[{"range":{"collectTime":{"gt":"1","lt":"200"}}}],"must_not":[],"should":[]}},"from":0,"sort":[],"aggs":{}}'
        docinfo => true
        }
    }
    filter{
             if [@metadata][_type] != "RFID" {
            drop{}
      }
    }
    output{
            elasticsearch{
                    hosts => "10.10.X.0:9200"
                    index => "index_new"
                    #document_type => "RFID"
                    document_id => "%{id}"
                    codec => json_lines
            }
            stdout{
                    codec => json_lines
            }
    }
    

    相关文章

      网友评论

          本文标题:logstash-过滤ES数据到新的ES

          本文链接:https://www.haomeiwen.com/subject/vohjdktx.html