Reputation: 71
I am collecting Twitter and Instagram data using Logstash and I want to save it to Elasticsearch, MongoDB, and MySQL. There are Logstash output plugins available for Elasticsearch and MongoDB but not for MySQL (it is a requirement to save this data to multiple databases). Any workaround for this? Thanks!
Upvotes: 2
Views: 15615
Reputation: 41
You should install plugin ouput-jdbc for logstash. Download from https://github.com/theangryangel/logstash-output-jdbc/tree/master And build、install 。
And then you can use like this:
input {
stdin{}
}
filter{
json{
source => "message"
}
}
output {
stdout{
codec=>rubydebug{}
}
jdbc {
connection_string => "jdbc:mysql://192.168.119.202:3306/outMysql?user=root&password=root"
statement => ["INSERT INTO user(userName,ip) values(?,?)","userName","ip"]
}
}
Upvotes: 4