Metricbeat, http: server gave HTTP response to HTTPS client

Hi all,
I am trying to activate basic security http in my ELK stack. My Elasticsearch version is 7.16.1. I create Elasticsearch-ssl-http.zip and add related files to config folder of Elasticsearch and kibana. Also I add below steps to Elasticsearch.yml:

xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: http.p12

and kibana.yml (kibana version is 7.13.1):

elasticsearch.ssl.certificateAuthorities: C:\ELK\kibana-7.13.1-windows-x86_64\kibana-7.13.1-windows-x86_64\config\elasticsearch-ca.pem

When I start elasticserach and kibana, every thing is ok and they are up.
At the next step, I am trying to do same things in the case of metricbeat, I copy "Elasticsearch-ca.pem" to metricbeat folder and add following to Elasticsearch output of metricbeat.yml:

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["https://127.0.0.1:9200"]
  indices:
   - index: "metric-%{+yyyy.MM}"
     
  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "**"
  ssl:
    certificate_authorities: ["elasticsearch-ca.pem"]
    verification_mode: "certificate"

But, when I start metricbeat, following error has been found:

2021-12-14T19:28:22.315+0330    ERROR   [publisher_pipeline_output]     pipeline
/output.go:154  Failed to connect to backoff(elasticsearch(https://127.0.0.1:9200)): Get "https://127.0.0.1:9200": http: server gave HTTP response to HTTPS cl
ient

Any advise will be so appreciated.

Regards

Could you try with just hosts: ["127.0.0.1:9200"] in the config?

Dear Kaiyan
Many thanks for your reply. It works in the case of http but I need to activate tls in the communication between metricbeat and elasticserach and it is needed to use https. I will be so appreciated if you can advice me about this.
Regards

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