What's better, multi config or one config(multi input)

hi, everybody.

i have used logstash for collecting the data of mysql.

the data of mysql have several tables, and i created config files like below.

tb_a.config

input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:59000/DB"
jdbc_user => "user"
jdbc_password => "pass"
statement => " SELECT * FROM TABLE_A "
schedule => "* * * * *"
}
}

output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "table_a"
document_type => "a"
document_id => "%{a_seq}"
}
}

tb_b.config

input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:59000/DB"
jdbc_user => "user"
jdbc_password => "pass"
statement => " SELECT * FROM TABLE_B "
schedule => "* * * * *"
}
}

output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "table_b"
document_type => "b"
document_id => "%{b_seq}"
}
}

and i runned logstash by below command.

logstash -f ../conf/tb_a.config &
logstash -f ../conf/tb_b.config &

but it was not good. if i need more collecting other table data, i will add config file.

recently, i saw this reply - http://stackoverflow.com/questions/37613611/multiple-inputs-on-logstash-jdbc

there was multi input. i look good that than mine.

My question, what's better multi config file or multi input. in my case, the table collected by logstash may be added.

sorry, low english.

thanks a lot.

If you have more than just a few configuration files or if you want to run Logstash as a service and not just from a terminal I suggest you run Logstash with multiple inputs.

1 Like

thank you! i think there is the advantage of maintenance. but Can I get other advantage by using multi input for service?

Well, you obviously reduce the resource usage by not running multiple JVMs.

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