# LogStash querying from Multiple DB

**URL:** <https://discuss.elastic.co/t/logstash-querying-from-multiple-db/68251>\
**Category:** Logstash\
**Created:** [December 7, 2016, 6:48am UTC](https://discuss.elastic.co/t/logstash-querying-from-multiple-db/68251 "2016-12-07T06:48:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinaya.Thimmappa](https://avatars.discourse-cdn.com/v4/letter/v/e68b1a/32.png) [@Vinaya.Thimmappa](https://discuss.elastic.co/u/Vinaya.Thimmappa)\
**Post date:** [December 7, 2016, 6:48am UTC](https://discuss.elastic.co/t/logstash-querying-from-multiple-db/68251/1 "2016-12-07T06:48:31Z")

</div>

I have a use case where in I have multiple Database in mysql.  
i.e DB1, DB2, DB3, DB4 .. and this is growing

I want to query on a particular table T1 in each of DB and index to ES using log-stash

I have one table in master DB which has all the DB created details. So i query that, then i get list of DB's . For each of this DB's, i want to do more query. How can i do this ?

How can i do this using log-stash only ? is this possible to do ?

One Solution is  
Run a script to get all DB names, for each DB, run a logstash separately.

Is there a better solution ?  
vinaya

---

<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:** [December 7, 2016, 7:01am UTC](https://discuss.elastic.co/t/logstash-querying-from-multiple-db/68251/2 "2016-12-07T07:01:54Z")

</div>

No, I don't believe there's a better way. If the database setup is dynamic you'll have to generate configurations outside of Logstash.

---

<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:** [January 4, 2017, 7:02am UTC](https://discuss.elastic.co/t/logstash-querying-from-multiple-db/68251/3 "2017-01-04T07:02:12Z")

</div>

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