input { beats { port => 5044 } } filter { clone { clones => ["to_stdout"] } if [type] == "to_stdout" { #display only message field in the logstash stdout prune { whitelist_names => ["message"] } mutate { add_field => { "[@metadata][type]" => "to_stdout" } } } else { mutate { add_field => { "[@metadata][type]" => "to_elasticsearch" } } } } output { if [@metadata][type][1] == "to_stdout" { stdout { codec => rubydebug } } else { elasticsearch { hosts => ["elasticsearch:9200"] } } }