logstash filter how to create two (or above ) outputs for the one input logstash filter how to create two (or above ) outputs for the one input elasticsearch elasticsearch

logstash filter how to create two (or above ) outputs for the one input


You can achieve that with the clone filter.

First, you need to install the plugin which is not bundled by default:

bin/logstash-plugin install logstash-filter-clone

Then you can modify your Logstash config like this:

input {  http_poller {    urls => {      test1 => "http://localhost:8080"    }    type => "A"  }}filter {    clone {        clones => [ "P" ]        add_tag => [ "P" ]    }    if [type] == "P" {        mutate {            remove_field => [ "address" ]        }    } else {        mutate {            add_tag => [ "A" ]            remove_field => [ "id", "name", "lastname", "age" ]        }    }}output {    elasticsearch {        hosts => ["localhost:9200"]        document_type => "%{type}"    }}