logstash导入日志数据到elasticsearch如何手动指定_id

我现在有这样一个需求,需要对从logstash导入elasticsearch的数据做update,logstash的elasticsearch-output-plugin 做update需要指定id,所以我想在导入初始数据的时候指定_id,这个_id来自我要导入到ES的一个字段,请问这样可以实现么,谢谢各位(logstash elasticsearch 版本是5.5.0)
已邀请:

novia - 1&0

赞同来自: zhujw laoyang360

output{
elasticsearch{
hosts => "xxx.xxx.xxx.xxx:9200"
flush_size => 100
index => "xxx_log_%{+yyyy.MM.dd}"
document_id => "%{uuid}"
manage_template => true
template_overwrite => true
template_name => "xx-log"
template => "/etc/xxx/template/xx_template.json"
}
stdout{
codec => rubydebug
}
}
document_id即可

netkiller

赞同来自: zhujw

这样实现
参考这个:https://www.netkiller.cn/datab ... dp125
 
input {
jdbc {
jdbc_driver_library => "/usr/share/java/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://netkiller:3306/cms"
jdbc_user => "cms"
jdbc_password => ""
schedule => "* * * * *"
statement => "select * from article"
}
}
output {
elasticsearch {
hosts => "netkiller:9200"
index => "information"
document_type => "article"
document_id => "%{id}"

}
}

 
 

laoyang360 - [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:blog.csdn.net/laoyang360

赞同来自:

顶一下!

要回复问题请先登录注册