Logstash 简单试用备忘
1. 从数据库里面输入开始试用
看 官网相关的教学blog 后用自己的 Mysql 测试
1.1. Mysql
mysql_to_elasticsearch.conf
---------------------------
input {
jdbc {
# Postgres jdbc connection string to our database, mydb
jdbc_connection_string => "jdbc:mysql://localhost:3306/databasename?characterEncoding=UTF-8&useSSL=false"
# The user we wish to execute our statement as
jdbc_user => "username"
jdbc_password => "password"
# The path to our downloaded jdbc driver
jdbc_driver_library => "D:\Applications\logstash-5.6.3\test_logstash_mysql\mysql-connector-java-5.1.44-bin.jar"
# The name of the driver class for Postgresql
jdbc_driver_class => "com.mysql.jdbc.Driver"
# our query
statement => "SELECT * from user"
# 定时运行
schedule => "* * * * *"
# 是否全量同步
clean_run => "false"
}
}
output {
elasticsearch {
index => "users"
document_type => "user"
document_id => "%{id}"
hosts => "http://localhost:9200/"
}
}
2017/10/11大约 4 分钟