# I have mulitple views in SQL (Input) and multiple INDEXES in ES (Output). How can I use logstash to deal with them in single config file?

**URL:** <https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800>\
**Category:** Logstash\
**Created:** [January 21, 2016, 4:31pm UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800 "2016-01-21T16:31:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrizwan](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mrizwan](https://discuss.elastic.co/u/mrizwan)\
**Post date:** [January 21, 2016, 4:31pm UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800/1 "2016-01-21T16:31:28Z")

</div>

I am new to ES 2.1 and Logstash. I was using \_river before for fetching records from SQL and can handle multiple queries and indexes in it.

Now I am using Logstash 2.1 and ES 2.1. The issue is, I am not able to deal with multiple sql queries indexes.  
So far I have done this in logstash config file and ftech the data from single sql view and populated single index in elasticsearch.

input {  
jdbc {  
jdbc\_driver\_library =\> "/opt/logstash/lib/sqljdbc4-2.0.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\>"jdbc:sqlserver://104.130.221.76:1433;databaseName=D\*\*\*S"  
jdbc\_user =\> "d\*\*\*\*\*\*\*\*\*\*\*\*r"  
jdbc\_password =\> "D\*\*\*\*\*\*\*\*_r"  
schedule =\> "_ \* \* \* \*"  
statement =\> "SELECT \* FROM Test2"  
}  
}

filter {

}  
output {  
elasticsearch {  
hosts =\> "1\*\*.\*\*\*.\*\*\*.\*\*\*0"  
index =\> "dallas-orders"  
document\_type =\> "dallas\_report"  
document\_id =\> "%{uid}"  
}  
}

Please help me to deal with multiple sql views and multiple es index. Hope my question clear. Looking forward for the positive response.

---

<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:** [January 21, 2016, 6:29pm UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800/2 "2016-01-21T18:29:01Z")

</div>

Use multiple jdbc inputs and—if needed—multiple elasticsearch outputs. To select which outputs and/or filters to use you can add fields or apply tags in the input and use conditionals in the filter and/or output blocks. See [https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html) for some ideas.

---

<div class="post-metadata">

**Author:** ![mrizwan](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mrizwan](https://discuss.elastic.co/u/mrizwan)\
**Post date:** [January 22, 2016, 11:57am UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800/3 "2016-01-22T11:57:00Z")

</div>

Thanks for the reply. Using multiple inputs and outputs worked for me.  
Another thing I want to ask about the scheduling of the Input.  
I want to schedule multiple inputs separately. Please help me regarding this.

---

<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:** [January 22, 2016, 12:00pm UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800/4 "2016-01-22T12:00:39Z")

</div>

Let's start a new thread for that unrelated question. Please also read the newly started thread below; it might answer your question.

> [@Can we schedule and run multiple conf files simultaneously for Logstash?](https://discuss.elastic.co/t/can-we-schedule-and-run-multiple-conf-files-simultaneously-for-logstash/39865):
>
> Hi All, Can i schedule my logstash config files and run them ? Is there any tool for such purposes ? Please reply if you have a solution. Thanks in advance !

---

<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:14am UTC](https://discuss.elastic.co/t/i-have-mulitple-views-in-sql-input-and-multiple-indexes-in-es-output-how-can-i-use-logstash-to-deal-with-them-in-single-config-file/39800/5 "2017-07-06T05:14:45Z")

</div>


