input {
rabbitmq {
host => "rabbitmq的ip:5672"
vhost => "/"
user => "rabbitmq用户名称"
password => "rabbimq密码"
durable => true
exchange => "pro.community.exchange" (配置指定rabbimq的交换器。)
exchange_type => "direct" (交换器类型)
key => "route.logstash.es.create" (这个是routingkey)
queue => "community_topic_create" (rabbimq队列名称)
}
}
filter {
}
output {
elasticsearch {
action => "create" (对es的操作行为,具体可以看官网,这里是新增索引填create)
hosts => ["elasticsearch的ip:9200"]
user => "elastic"
password => "密码"
index => "索引名称"
document_id => "%{documentId}" (指定es文档id,便于修改和删除)
document_type => "%{documentType}"
}
}