# Inline statement parameter

**URL:** <https://discuss.elastic.co/t/inline-statement-parameter/72509>\
**Category:** Logstash\
**Created:** [January 23, 2017, 4:31pm UTC](https://discuss.elastic.co/t/inline-statement-parameter/72509 "2017-01-23T16:31:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinodMS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinodms/32/13476_2.png) [@vinodMS](https://discuss.elastic.co/u/vinodMS)\
**Post date:** [January 23, 2017, 4:31pm UTC](https://discuss.elastic.co/t/inline-statement-parameter/72509/1 "2017-01-23T16:31:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 24, 2017, 6:50am UTC](https://discuss.elastic.co/t/inline-statement-parameter/72509/2 "2017-01-24T06:50:57Z")

</div>

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](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.)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 21, 2017, 6:50am UTC](https://discuss.elastic.co/t/inline-statement-parameter/72509/3 "2017-02-21T06:50:57Z")

</div>

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