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 => "%{id}"
}
stdout {
codec => json_lines
}
}
|