我正在尝试设置一个 logstash 工作程序,它从一个 amqp/rabbitmq 队列中获取所有消息,过滤一些消息以发送到 statsD,但也将所有消息发送到弹性搜索。以下实现仅不向 ElasticSearch 发送任何消息。
input {
rabbitmq {
host => "amqp-host"
queue => "elasticsearch"
key => "elasticsearch"
exchange => "elasticsearch"
type => "all"
durable => true
auto_delete => false
exclusive => false
format => "json_event"
debug => false
}
}
filter {
grep {
add_tag => "grepped"
match => ["@message", "Execution of .*? took .* sec"]
}
grok {
tags => ["grepped"]
add_tag => "grokked"
pattern => "Execution of %{DATA:command_name} took %{DATA:response_time} sec"
}
mutate {
tags => ["grepped", "grokked"]
lowercase => [ "command_name" ]
add_tag => ["mutated"]
}
}
output {
elasticsearch_river {
type => "all"
rabbitmq_host => "amqp-host"
debug => false
durable => true
persistent => true
es_host => "es-host"
exchange => "logstash-elasticsearch"
exchange_type => "direct"
index => "logs-%{+YYYY.MM.dd}"
index_type => "%{@type}"
queue => "logstash-elasticsearch"
}
statsd {
type => "command-filter"
tags => ["grepped", "grokked", "mutated"]
host => "some.domain.local"
port => 1234
sender => ""
namespace => ""
timing => ["prefix.%{command_name}.suffix", "%{response_time}"]
increment => ["prefix.%{command_name}.suffix"]
}
}
有什么包罗万象的过滤器吗?或者一种安排标签的方法,以便过滤一些消息但全部转发到 ES?