1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| ### vi jdbc-test.conf input { stdin { } jdbc { # mysql链接地址 jdbc_connection_string => "jdbc:mysql://localhost:3306/test" # 用户、密码 jdbc_user => "root" jdbc_password => "" # jdbc driver路径 jdbc_driver_library => "path/to/mysql-connector-java-5.1.36.jar" # the name of the driver class for mysql jdbc_driver_class => "com.mysql.jdbc.Driver" jdbc_paging_enabled => "true" jdbc_page_size => "50000" ## 执行的sql 文件路径+名称 statement => "sql语句" statement_filepath => "./sql/jdbc.sql" ## schedule:设置监听间隔 schedule => "* * * * *" type => "jdbc" } }
filter { json { source => "message" remove_field => ["message"] } }
output { elasticsearch { hosts => ["http://localhost:9200"] index => "jdbc-test-%{+YYYY.MM.dd}" } stdout{ codec => rubydebug } }
|