From several jdbs connection work only one


(Michael Limarev) #1

Hi.
I try to make logstash (V 5.5) to read from 2 tables, and it actually does this at first.
Logstash reads data from the first table, then from the second one.
But then it begins to read only from one of them and I don't understand where is the problem.
(Sory for this decor)

input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/ams"
# The user we wish to execute our statement as
jdbc_user => ""
jdbc_password => ""
# The path to our downloaded jdbc driver
jdbc_driver_library => "mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar"
# The name of the driver class for Postgresql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "5000"
# our query
schedule => "*/1 * * * "
statement => "
SELECT login_info user
FROM login_event
WHERE id > :sql_last_value
"
use_column_value => true
tracking_column => "id"
tracking_column_type => "numeric"
clean_run => true
type => "loginEvent"
}
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/ams"
# The user we wish to execute our statement as
jdbc_user => ""
jdbc_password => ""
# The path to our downloaded jdbc driver
jdbc_driver_library => "mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar"
# The name of the driver class for Postgresql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "5000"
# our query
# schedule => "
/1 * * * *"
statement => "
SELECT start_time, duration, id, created_at, user
FROM content_event
WHERE id > :sql_last_value
"
use_column_value => true
tracking_column => "id"
tracking_column_type => "numeric"
clean_run => true
type => "contentEvent"
}
}
output {
stdout { codec => json_lines }
elasticsearch {
"hosts" => "localhost:9200"
"index" => "ams"
"document_type" => "%{type}"
"document_id" => "%{id}"
}
}


(Magnus B├Ąck) #2

With two jdbc inputs you should set last_run_metadata_path to unique values so that the state of one plugin doesn't overwrite the state of the other.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.