# 401 Authorization Error with logstash elastic cloud module

**URL:** <https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477>\
**Category:** Logstash\
**Created:** [August 29, 2018, 7:27am UTC](https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477 "2018-08-29T07:27:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aashishgahlawat](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aashishgahlawat](https://discuss.elastic.co/u/aashishgahlawat)\
**Post date:** [August 29, 2018, 7:27am UTC](https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477/1 "2018-08-29T07:27:11Z")

</div>

[Official logstash elastic cloud module](https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html)

[Official doc for starting with](https://www.elastic.co/guide/en/cloud/saas-release/ec-cloud-id.html)

My logstash.yml looks like:

```
# ------------ Cloud Settings ---------------
# Define Elastic Cloud settings here.
# Format of cloud.id is a base64 value e.g. dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRub3RhcmVhbCRpZGVudGlmaWVy
# and it may have an label prefix e.g. staging:dXMtZ...
# This will overwrite 'var.elasticsearch.hosts' and 'var.kibana.host'
# cloud.id: <identifier>
  cloud.id: "Test:testkey"
#
# Format of cloud.auth is: <user>:<pass>
# This is optional
# If supplied this will overwrite 'var.elasticsearch.username' and 'var.elasticsearch.password'
# If supplied this will overwrite 'var.kibana.username' and 'var.kibana.password'
# cloud.auth: elastic:<password>
  cloud.auth: "elastic:password"

```

This is all I have in logstash.yml and nothing else,   
  
And I am getting:

`[2018-08-29T12:33:52,112][WARN][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"https://myserverurl:12345/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'https://myserverurl:12345/'"}`

And the config looks like:

```
input{jdbc{...jdbc here... This works, as I see data in windows console}}
output {
    stdout { codec => json_lines }
    elasticsearch {
    hosts => ["myserverurl:12345"]
    index => "my_index"
    # document_id => "%{brand}"
    }

```

What I am doing is bin/logstash on windows,  
It loads data from database that I have configured in input of conf file and then shows me error, I want to index my data from `MySQL` to elasticsearch on Cloud, I took 14 days trial and created a test index, for learning purpose as I later have to deploy it.  
My Pipeline looks like:

```
  - pipeline.id: my_id
    path.config: "./config/conf_file_name.conf"
    pipeline.workers: 1

```

If logs won't include senistive data, I can also provide them.

---

<div class="post-metadata">

**Author:** ![aashishgahlawat](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aashishgahlawat](https://discuss.elastic.co/u/aashishgahlawat)\
**Post date:** [August 29, 2018, 8:28am UTC](https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477/2 "2018-08-29T08:28:18Z")

</div>

[Configure logstash config file docs](https://www.elastic.co/guide/en/cloud/current/ec-logstash.html)  
The output shall include  
elasticsearch {  
hosts =\> ["[https://host](https://host):port/"]  
user =\> "elastic"  
password =\> "password"  
# protocol =\> https  
# port =\> "port"  
index =\> "test\_index"  
# document\_id =\> "%{id}"

---

<div class="post-metadata">

**Author:** ![aashishgahlawat](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aashishgahlawat](https://discuss.elastic.co/u/aashishgahlawat)\
**Post date:** [August 29, 2018, 3:03pm UTC](https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477/3 "2018-08-29T15:03:47Z")

</div>

When I already have specified my password in settings file, why do I again need to specify it in every config file?

---

<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:** [September 26, 2018, 3:03pm UTC](https://discuss.elastic.co/t/401-authorization-error-with-logstash-elastic-cloud-module/146477/4 "2018-09-26T15:03:48Z")

</div>

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