Inline statement parameter

Hello,

I need to create multiple indices from multiple mysql tables and I'd like to use logstash to perform this task.

The issue I have here is that instead of having to create multiple logstash configuration files I'd like to have one and then pass the table name inline during script execution.

Say that I have the following input,

INPUT {
  jdbc {
    jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/mydb"
    jdbc_user => "mysql"
    schedule => "* * * * *"
    statement => "SELECT * from table"
  }
}

I'd like the replace the table value when I run the configuration so that I don't need to create nearly 1000 configurations just to change the table name.

It would of course be trivial to generate the needed configuration files, but it's easier to put the table name in an environment variable and reference it.

https://www.elastic.co/guide/en/logstash/current/environment-variables.html

(In Logstash 2.x you need to start with --allow-env for this to work.)

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