通过logstash

时间:2016-10-31 10:42:09

标签: logstash

在我的mysql中,例如2表,彼此之间的关系就像这样

product1 : [{id:1,name:abc1},{id:2,name:abc2},{id:3,name:abc3}]

product2 : [{id:1,product1_id:2,status:like},{id:2,product1_id:2,status:
dislike},{id:1,product1_id:1,status:like}]

如何在我的mysql示例中收集信息logstash以在elasticsearch中获取这样的数据结构

_souce : {
   "id" : "1"
   "name" : "abc1"
   "status" : [
       "like"
   ]
}

...

_souce : {
   "id" : "2"
   "name" : "abc2"
   "status" : [
       "like",
       "dislike"
   ]
}

...

tôibiếtrằngphảicấuhìnhtrongfile logstash.conf vàđâylàmộtđoạncấuhìnhtrongđó

jdbc_driver_library => "path/mysql-connector-java-5.1.23-bin.jar"

jdbc_driver_class => "com.mysql.jdbc.Driver"

jdbc_connection_string => "jdbc:mysql://localhost:9200/abc"

jdbc_user => "***"

jdbc_password => "***"

statement => "SELECT product1.id,product1.name,product2.status FROM product1 LEFT JOIN product2 ON product1.id = product2.product1_id"

但数据并不像我希望我会得到答案

我不限于英语,希望人们能够理解我的需要gi.Thanks

0 个答案:

没有答案