I'm tring to use logstash to synchronize mysql tables to elasticsearch. At first there was only one input for synchronizing table 'article' and went well. Then I appended another input for synchronizing table 'user', but the second index 'user_index' is not created and data is not imported to elasticsearch.
input {
jdbc {
jdbc_connection_string => ""
jdbc_user => ""
jdbc_password => ""
schedule => "* * * * *"
jdbc_validate_connection => true
jdbc_driver_library => ""
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => true
tracking_column => "unix_ts_in_secs"
use_column_value => true
tracking_column_type => "numeric"
statement => "SELECT *, UNIX_TIMESTAMP(modify_time) AS unix_ts_in_secs FROM article WHERE (UNIX_TIMESTAMP(modify_time) > :sql_last_value AND modify_time < NOW()) ORDER BY modify_time ASC"
tags => ["article"]
}
jdbc {
jdbc_connection_string => ""
jdbc_user => ""
jdbc_password => ""
schedule => "* * * * *"
jdbc_validate_connection => true
jdbc_driver_library => ""
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => true
tracking_column => "unix_ts_in_secs"
use_column_value => true
tracking_column_type => "numeric"
statement => "SELECT id, name, avatar, UNIX_TIMESTAMP(modify_time) AS unix_ts_in_secs FROM user WHERE (UNIX_TIMESTAMP(modify_time) > :sql_last_value AND modify_time < NOW()) ORDER BY modify_time ASC"
tags => ["user"]
}
}
output {
if "article" in [tags] {
elasticsearch {
index => "article_index"
document_id => "%{id}"
}
}
if "user" in [tags] {
elasticsearch {
index => "user_index"
document_id => "%{id}"
}
}
stdout {
codec => rubydebug
}
}