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?


(Rizwan) #1

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.


(Magnus Bäck) #2

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 for some ideas.


(Rizwan) #3

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.


(Magnus Bäck) #4

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


(system) #5