# How create dynamic query in logstash?

**URL:** <https://discuss.elastic.co/t/how-create-dynamic-query-in-logstash/79119>\
**Category:** Logstash\
**Created:** [March 18, 2017, 7:23am UTC](https://discuss.elastic.co/t/how-create-dynamic-query-in-logstash/79119 "2017-03-18T07:23:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yur\_Gasparyan](https://avatars.discourse-cdn.com/v4/letter/y/7c8e57/32.png) [@Yur\_Gasparyan](https://discuss.elastic.co/u/Yur_Gasparyan)\
**Post date:** [March 18, 2017, 7:23am UTC](https://discuss.elastic.co/t/how-create-dynamic-query-in-logstash/79119/1 "2017-03-18T07:23:20Z")

</div>

Hi all. I need your help.  
In my db config I have code look like this

```
jdbc {
		jdbc_connection_string => "jdbc:mysql//localhost:3306/mydb"
		jdbc_user => "root"
		jdbc_password => ""
		jdbc_driver_library => "C:/servers/elasticsearch/con.mysql.jdbc_5.1.5.jar"
		jdbc_driver_class => "com.mysql.jdbc.Driver"
		parameters => { "like" => "Beethoven" }
		statement => "Select* from users where name = :like"
	}

```

This statement is test and my goal will be very larg sql with more than 4-5 join with dynamic columns and values, Please help me. Can I pass this parameters dynamicly ?. For example I am using Elasticsearch PHP Client library.  
Thanks  
Yuri

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [March 18, 2017, 7:44pm UTC](https://discuss.elastic.co/t/how-create-dynamic-query-in-logstash/79119/2 "2017-03-18T19:44:09Z")

</div>

no there is no way to "provide" a dynamic variable to an input like your asking. Inputs are the beginning of the data, so besides an environment variable ${HOME} once loaded you can not change how it is querying.

One thought your could have a table of your dynamic data just thought about this idea.

select \* from users where ( select user from dynamic\_users ) blah blah blah

---

<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:** [April 15, 2017, 7:44pm UTC](https://discuss.elastic.co/t/how-create-dynamic-query-in-logstash/79119/3 "2017-04-15T19:44:12Z")

</div>

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