Connecting metricbeat to elasticsearch using ssl connection

Good afternoon, can you help with connecting metricbeat to elasticsearch wazuh
The file /etc/elasticsearch/elasticsearch.yml looks like this: elasticsearch
cluster.initial_master_nodes: elasticsearch

# Transport layer true certificate /etc/elasticsearch/certs/elasticsearch.key /etc/elasticsearch/certs/elasticsearch.crt /etc/elasticsearch/certs/ca/ca.crt

# HTTP layer true certificate /etc/elasticsearch/certs/elasticsearch.key /etc/elasticsearch/certs/elasticsearch.crt /etc/elasticsearch/certs/ca/ca.crt

# Elasticsearch authentication true /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

The file /etc/metricbeat/metricbeat/metricbeat.yml looks like this to me:

  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  # Protocol - either `http` (default) or `https`.
  protocol: "https"
  # Authentication credentials - either API key or username/password.
  #api_key: "${ES_API_KEY}"
  #api_key: "xxxx"
  #username: "elastic"
  #password: "xxxxx"
  ssl.certificate_authorities: ["/etc/elasticsearch/certs/ca/ca.crt"]
  ssl.certificate: "/etc/elasticsearch/certs/elasticsearch.crt"
  ssl.key: "/etc/elasticsearch/certs/elasticsearch.key"
  ssl.key_passphrase: "xxxxx"

But when checked with the command :

./metricbeat test output -c /etc/metricbeat/metricbeat.yml --path.home /usr/share/metricbeat/ /var/lib/metricbeat
elasticsearch: https://localhost:9200...
  parse url... OK
    parse host... OK
    dns lookup... OK
    addresses: ::1,
    dial up... OK
    security: server's certificate chain verification is enabled
    handshake... ERROR x509: certificate is not valid for any names, but wanted to match localhost

I get an authorization error, can you tell me what I'm doing wrong?

How did you generate cert? hostname, localhost or IP?
The hosts: ["localhost:9200"] value must match cert name in the subject or the alt name.

Hi @website Welcome to the community

What version?, you should always include that.

How what version did you install of elasticsearch?

You should not need these

This should suffice:

ssl.certificate_authorities: ["/etc/elasticsearch/certs/ca/ca.crt"]

And then @Rios is asking the right question how did you create the elasticsearch certificate

Good afternoon I solved the problem, but there was an error with the address, I have version 7.17 installed, but after installing metricbeat, the data is not displayed in Kibana, what could be the reason?

Hi @website

Did you run setup command before starting metricbeat?

That is a crucial step...

metricbeat setup -e

if you did not you will need to delete the metricbeat index then run setup and try again.

Also did you check in discover to see if you are actually getting data?

I see you are trying the prometheus module ... are you sure it is configured correctly?

Following the quick start help your would just be with the prometheus module

Did you look at the metricbeat logs and see if there any other issues?

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