How to filebeat logs to elastic cloud

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)): 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:

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

I create api_key from here:

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

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>

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