# Is there a way to remove duplicate code in logstash?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-remove-duplicate-code-in-logstash/199569>\
**Category:** Logstash\
**Created:** [September 16, 2019, 4:45am UTC](https://discuss.elastic.co/t/is-there-a-way-to-remove-duplicate-code-in-logstash/199569 "2019-09-16T04:45:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [September 16, 2019, 4:45am UTC](https://discuss.elastic.co/t/is-there-a-way-to-remove-duplicate-code-in-logstash/199569/1 "2019-09-16T04:45:20Z")

</div>

Can I include duplicate code in a specific file in the log?

For example, when importing data from multiple db tables, you need to keep writing  
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"  
......  
}

Is there a way to remove duplicate code like this?  
I want to put duplicate code content into a file and load it from the logstash conf file.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 16, 2019, 5:21am UTC](https://discuss.elastic.co/t/is-there-a-way-to-remove-duplicate-code-in-logstash/199569/2 "2019-09-16T05:21:41Z")

</div>

No, I do not think that is possible.

---

<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:** [October 14, 2019, 5:21am UTC](https://discuss.elastic.co/t/is-there-a-way-to-remove-duplicate-code-in-logstash/199569/3 "2019-10-14T05:21:53Z")

</div>

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