# How to define cloud id in logstash config file?

**URL:** <https://discuss.elastic.co/t/how-to-define-cloud-id-in-logstash-config-file/135584>\
**Category:** Logstash\
**Created:** [June 12, 2018, 6:49pm UTC](https://discuss.elastic.co/t/how-to-define-cloud-id-in-logstash-config-file/135584 "2018-06-12T18:49:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcukinyahoo](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@fcukinyahoo](https://discuss.elastic.co/u/fcukinyahoo)\
**Post date:** [June 12, 2018, 6:49pm UTC](https://discuss.elastic.co/t/how-to-define-cloud-id-in-logstash-config-file/135584/1 "2018-06-12T18:49:23Z")

</div>

What I am trying to accomplish is execute sql query against our mssql database, pass that data to ES stack in cloud.

To my understanding I have to take following actions,  
install jdk on windows client where i ll be sending data from,  
install logstash on windows client where i ll be sending data from,  
install logstash-input-jdbc on windows client where i ll be sending data from,  
change logstash.conf to add cloud id and user credentials,  
create data-out.conf file like below,

```
input {
  jdbc {
jdbc_driver_library => "sqljdbc4.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://192.168.2.126\\SQLEXPRESS2014:1433;databaseName=test
	jdbc_password => "sa@sa2015"
schedule => "0 0-59 0-23 * * *"
statement => "SELECT ID , Name, City, State,ShopName FROM dbo.Shops"
	jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
  }
}
filter {
}
output {
  stdout { codec => rubydebug }
elasticsearch { 
    protocol => "http"
		index => "shops"
		document_id => "%{id}"
}
}

```

create index on ES Kibana UI.

What confuses me is "elasticsearch { protocol =\> "http"" section. Will this "data-out.conf" find the cloud ES instance by checking against main "logstash.conf"?

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [June 12, 2018, 9:06pm UTC](https://discuss.elastic.co/t/how-to-define-cloud-id-in-logstash-config-file/135584/2 "2018-06-12T21:06:39Z")

</div>

> Will this "data-out.conf" find the cloud ES instance by checking against main "logstash.conf"?

I assume you mean .yml, not .conf ? (if so...)

The Elasticsearch settings in logstash.yml are only applicable to monitoring, management, and modules. You still have to define your hosts (and credentials if needed) in the `output {` section of your configuration [1].

If have 1 instance/cluster of Elasticsearch , it does become a bit redundant to redefine the same connection everywhere. Also note, the `output {` section does not currently allow for a cloud\_id , you will need to use the host name(s) directly.

[1]

> **[Elasticsearch output plugin | Logstash Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-hosts)**

---

<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 10, 2018, 9:06pm UTC](https://discuss.elastic.co/t/how-to-define-cloud-id-in-logstash-config-file/135584/3 "2018-07-10T21:06:40Z")

</div>

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