Perhaps take a look at this thread
It refers to Packetbeat but the concept / code is the same.
Assuming you just want to use log stash as the pass through then Your logstash conf file should look like this
################################################
# beats->logstash->es default config.
################################################
input {
beats {
port => 5044
}
}
output {
if [@metadata][pipeline] {
elasticsearch {
cloud_auth => "elastic:password"
cloud_id => "mycloud:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRj......"
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}"
pipeline => "%{[@metadata][pipeline]}"
}
} else {
elasticsearch {
cloud_auth => "elastic:password"
cloud_id => "mycloud:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRj......"
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}"
}
}
}