1.先pull镜像 1 docker pull logstash:7.6.2 1 2 mkdir -p /usr/share/logstash/conf.d mkdir /usr/share/logstash/log 1 vim logstash.yml 1 2 path.config: /usr/share/logstash/conf.d/*.conf path.logs: /usr/share/logstash/log vim test.conf 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 input { stdin { } jdbc { jdbc_connection_string => "jdbc:mysql://url:port/database?useSSL=false&useUnicode=true&characterEncoding=utf-8&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai" jdbc_driver_class => "com.mysql.cj.jdbc.Driver" jdbc_user => "root" jdbc_password => "root" jdbc_paging_enabled => "true" jdbc_page_size => "50000" jdbc_default_timezone => "Asia/Shanghai" jdbc_driver_library => "/usr/share/logstash/conf.d/mysql-connector-java-8.0.28.jar" statement => "SELECT * FROM table_name" schedule => "* * * * *" lowercase_column_names => false } } filter { date { match => ["time_stamp","yyyy-MM-dd HH:mm:ss.SSS"] target => "@time_stamp" } } output { elasticsearch { hosts => ["http://url:9200"] index => "your self index" document_id =>……
阅读全文