This is using logstash 5.2.0 and the version of the RabbitMQ plugin that comes with it.
input {
rabbitmq {
...
add_field => {
"[@metadata][indexType]" => "myindex"
}
}
output {
elasticsearch {
hosts => ["elasticsearch"]
index => "%{[@metadata][indexType]}-%{+YYYY.MM.dd}"
}
}
Results in errors due to [@metadata][indexType] not being set. But this workaround does work:
input {
rabbitmq {
...
add_field => {
"indexType" => "myindex"
}
}
filter {
mutate {
add_field => { "[@metadata][indexType]" => "%{indexType}" }
remove_field => [ "indexType" ]
}
}
...
Googling suggested to me that the prior syntax is expected to work, at least for the file plugin. Is this a bug?