配置文件如下所示,附上日志:
input {
stdin {
}
jdbc {
jdbc_driver_library => "/usr/share/logstash/config/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:@//192.168.10.5:1521/orcl"
jdbc_user => "sdystr"
jdbc_password => "shandong"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
jdbc_default_timezone => "Asia/Shanghai"
statement => "SELECT * FROM Person_Info"
# schedule => "* * * * * Asia/Shanghai"
# type => ""#####LAB_SERVER_NO#####""
record_last_run => "true"
use_column_value => "true"
tracking_column_type => "timestamp"
tracking_column => "ID"
last_run_metadata_path => "/usr/share/logstash/config/last_datetime/Person_Info"
clean_run => "false"
lowercase_column_names => "false"
}
}
filter {
json {
source => "message"
remove_field => ["message","@version","host","@timestamp"]
}
}
output {
jdbc {
driver_jar_path => "/opt/logstash-6.3.1/config/mysql-connector-java-8.0.11.jar"
driver_class => "com.mysql.jdbc.Driver"
connection_string => "jdbc:mysql://192.168.10.61:3306//ystr2?autoReconnect=true&usrSSL=true&user=ystr2&password=ystr2"
statement => ["insert into table(column1,column2) values(?,?)","%{[message][1]}","%{[message][2]}"]
}
}
input {
stdin {
}
jdbc {
jdbc_driver_library => "/usr/share/logstash/config/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:@//192.168.10.5:1521/orcl"
jdbc_user => "sdystr"
jdbc_password => "shandong"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
jdbc_default_timezone => "Asia/Shanghai"
statement => "SELECT * FROM Person_Info"
# schedule => "* * * * * Asia/Shanghai"
# type => ""#####LAB_SERVER_NO#####""
record_last_run => "true"
use_column_value => "true"
tracking_column_type => "timestamp"
tracking_column => "ID"
last_run_metadata_path => "/usr/share/logstash/config/last_datetime/Person_Info"
clean_run => "false"
lowercase_column_names => "false"
}
}
filter {
json {
source => "message"
remove_field => ["message","@version","host","@timestamp"]
}
}
output {
jdbc {
driver_jar_path => "/opt/logstash-6.3.1/config/mysql-connector-java-8.0.11.jar"
driver_class => "com.mysql.jdbc.Driver"
connection_string => "jdbc:mysql://192.168.10.61:3306//ystr2?autoReconnect=true&usrSSL=true&user=ystr2&password=ystr2"
statement => ["insert into table(column1,column2) values(?,?)","%{[message][1]}","%{[message][2]}"]
}
}
1 个回复
medcl - 今晚打老虎。
赞同来自: ljx95315