# Is it possible to set the MySql Session or Global variable in logstash input configuration file?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-set-the-mysql-session-or-global-variable-in-logstash-input-configuration-file/137268>\
**Category:** Logstash\
**Created:** [June 25, 2018, 1:50pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-the-mysql-session-or-global-variable-in-logstash-input-configuration-file/137268 "2018-06-25T13:50:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoseRohit](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JoseRohit](https://discuss.elastic.co/u/JoseRohit)\
**Post date:** [June 25, 2018, 1:50pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-the-mysql-session-or-global-variable-in-logstash-input-configuration-file/137268/1 "2018-06-25T13:50:07Z")

</div>

I want to set a MySql session variable through logstash input configuration file.  
For example :

input {  
jdbc {  
jdbc\_driver\_library =\> "D:\logstash\lib\mysql-connector-java-5.1.35.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "**"  
jdbc\_user =\> "root"  
jdbc\_password =\> "root"  
statement =\> "SET SESSION optimizer\_switch='block\_nested\_loop=off'"  
type =\> "a"  
}  
jdbc {  
jdbc\_driver\_library =\> "D:\logstash\lib\mysql-connector-java-5.1.35.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "\*\*\*\*"  
jdbc\_user =\> "root"  
jdbc\_password =\> "root"  
statement =\> "SELECT \* from table1"  
jdbc\_paging\_enabled =\> "true"  
jdbc\_page\_size =\> "50000"  
}  
jdbc {  
jdbc\_driver\_library =\> "D:\logstash\lib\mysql-connector-java-5.1.35.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "**"  
jdbc\_user =\> "root"  
jdbc\_password =\> "root"  
statement =\> "SET SESSION optimizer\_switch='block\_nested\_loop=on'"  
type =\> "a"  
}  
}

---

<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:** [July 23, 2018, 1:50pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-the-mysql-session-or-global-variable-in-logstash-input-configuration-file/137268/2 "2018-07-23T13:50:09Z")

</div>

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