# How to filebeat logs to elastic cloud

**URL:** <https://discuss.elastic.co/t/how-to-filebeat-logs-to-elastic-cloud/299098>\
**Category:** Beats\
**Tags:** elastic-stack-security, docker, filebeat\
**Created:** [March 8, 2022, 2:09pm UTC](https://discuss.elastic.co/t/how-to-filebeat-logs-to-elastic-cloud/299098 "2022-03-08T14:09:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sulfred](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sulfred/32/101276_2.png) [@sulfred](https://discuss.elastic.co/u/sulfred)\
**Post date:** [March 8, 2022, 2:09pm UTC](https://discuss.elastic.co/t/how-to-filebeat-logs-to-elastic-cloud/299098/1 "2022-03-08T14:09:12Z")

</div>

I am trying the Elastic Cloud. I want to send logs to the cloud with filebeat. I am keep receiving errors:

> pipeline/output.go:154 Failed to connect to backoff(elasticsearch([https://cloud-name-instance.aws.elastic-cloud.com:9243](https://cloud-name-instance.aws.elastic-cloud.com:9243))): 401 Unauthorized:

I know that is related to access issue but I am not sure how to fix it. Here is my filebeat config file:

filebeat.yml:

```auto
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /usr/share/filebeat/my_test_log/*.log

# cloud.id: "cloud-name-instance:ccccccccccccccccccccccccccccccccccc"
# cloud.auth: "my_login_id:my_pass_word"

output.elasticsearch:
  hosts: ["https://cloud-name-instance.aws.elastic-cloud.com:9243"]
  api_key: cccccccccccccccccccccccccccc

  # username: "my_login_id"
  # password: "my_pass_word"

```

My filebeat is running in a docker container. I have tried `username`, `password`, `api_key`, `cloud.id`, `cloud.auth` but seems not working. I would like to ask what is the correct config.

I am following this config example: [https://github.com/elastic/beats/blob/main/filebeat/filebeat.yml](https://github.com/elastic/beats/blob/main/filebeat/filebeat.yml)

I create api\_key from here:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4c498c2ed8eaee51795be7d8c28140b40d49a1f3.png)

`my_login_id` : the user name that I used to login the cloud elastic stack  
`my_pass_word` : the password that I used to login the cloud elastic stack

Thanks

---

<div class="post-metadata">

**Author:** ![sulfred](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sulfred/32/101276_2.png) [@sulfred](https://discuss.elastic.co/u/sulfred)\
**Post date:** [March 9, 2022, 1:41am UTC](https://discuss.elastic.co/t/how-to-filebeat-logs-to-elastic-cloud/299098/2 "2022-03-09T01:41:54Z")

</div>

I use the id as elastic and the password from the cloud elk and I am able to send logs to the cloud.  
This is resolved. Thanks.

Basically, I am not using `api_key`. I used `cloud.id`, `cloud.auth: "elastic:the password"`, `username: elastic`, `password: <the password>`

---

<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:** [April 6, 2022, 3:42am UTC](https://discuss.elastic.co/t/how-to-filebeat-logs-to-elastic-cloud/299098/3 "2022-04-06T03:42:20Z")

</div>

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