# JDBC input plugin to feed JSON from database table

**URL:** <https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876>\
**Category:** Logstash\
**Created:** [December 23, 2015, 4:37pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876 "2015-12-23T16:37:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinmoyd](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@chinmoyd](https://discuss.elastic.co/u/chinmoyd)\
**Post date:** [December 23, 2015, 4:37pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876/1 "2015-12-23T16:37:37Z")

</div>

I need to feed JSON data from a PostGreSQL table as input to logstash. For this, I shall use the JDBC input plugin. In Kibana I need to display only selective fields from this JSON. So, somewhere I need to parse this JSON.

From the documentation, it appears to me that the json codec plugin in logstash can help me to achieve the same. Can you please provide some example of the json codec plugin?

---

<div class="post-metadata">

**Author:** ![CraigFoote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigfoote/32/4571_2.png) [@CraigFoote](https://discuss.elastic.co/u/CraigFoote)\
**Post date:** [December 23, 2015, 6:37pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876/2 "2015-12-23T18:37:57Z")

</div>

I'm not sure I understand the problem but I'll give it a try. I've used the JDBC Logstash input plugin with Oracle and MySQL DBs. The plugin handles the creation of the JSON (by default using the JSON codec I guess), creating a field for each column. I've been able to manage the number of fields by using the SELECT statement identifying only the columns I want.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 23, 2015, 9:43pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876/3 "2015-12-23T21:43:44Z")

</div>

Have you seen [https://www.elastic.co/guide/en/logstash/current/plugins-filters-json.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-json.html)?

---

<div class="post-metadata">

**Author:** ![chinmoyd](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@chinmoyd](https://discuss.elastic.co/u/chinmoyd)\
**Post date:** [December 24, 2015, 4:52pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876/4 "2015-12-24T16:52:11Z")

</div>

Thanks

---

<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 6, 2017, 5:17am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-to-feed-json-from-database-table/37876/5 "2017-07-06T05:17:20Z")

</div>


