# Metricbeat not able to connect with x-pack enabled elastic

**URL:** https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753
**Category:** Beats
**Tags:** metricbeat
**Created:** [July 23, 2019, 7:18am UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753 "2019-07-23T07:18:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![abhishek13](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abhishek13](https://discuss.elastic.co/u/abhishek13)
#### Post date: [July 23, 2019, 7:18am UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753/1 "2019-07-23T07:18:11Z")

</div>

Hi

While connecting metricbeat with x-pack enabled elastic cluster , i am getting below error.

```
2019-07-23T12:45:21.103+0530	INFO	instance/beat.go:292	Setup Beat: metricbeat; Version: 7.2.0
2019-07-23T12:45:21.103+0530	INFO	[index-management]	idxmgmt/std.go:178	Set output.elasticsearch.index to 'metricbeat-7.2.0' as ILM is enabled.
2019-07-23T12:45:21.104+0530	ERROR	tlscommon/tls.go:151	Failed reading CA certificate: <nil>
2019-07-23T12:45:21.105+0530	INFO	instance/beat.go:385	metricbeat stopped.
2019-07-23T12:45:21.105+0530	ERROR	instance/beat.go:877	Exiting: error initializing publisher: 1 error: file is not a certificate adding /etc/metricbeat/ca.crt
Exiting: error initializing publisher: 1 error: file is not a certificate adding /etc/metricbeat/ca.crt

```

**OUTPUT CONFIGURATION**

```
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["10.0.0.1:9200"]

  # Optional protocol and basic auth credentials.
  protocol: "https"
  ssl.certificate_authorities: ["/etc/metricbeat/ca.crt"]
  ssl.certificate: "/etc/metricbeat/my.cer"
  ssl.key: "/etc/metricbeat/my.key"
  username: "username"
  password: "password"
```

---

<div class="post-metadata">

### Author: ![abhishek13](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abhishek13](https://discuss.elastic.co/u/abhishek13)
#### Post date: [July 23, 2019, 1:37pm UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753/2 "2019-07-23T13:37:29Z")

</div>

Got it.Actually i had enabled tls encryption on elasticsearch ,so after disabling the protocol and converting the ca file in pem format same worked fine.

**Update Config**

```
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["10.0.0.1:9200"]

  # Optional protocol and basic auth credentials.
  #protocol: "https"
  ssl.certificate_authorities: ["/etc/metricbeat/ca.crt"]
  ssl.certificate: "/etc/metricbeat/my.cer"
  ssl.key: "/etc/metricbeat/my.key"
  username: "username"
  password: "password"

```

`You could try your certificate here. Just replace the cert text and click Run. [https://play.golang.org/p/4UvK6TBeud](https://play.golang.org/p/4UvK6TBeud)`

**Command for conversion**

`openssl pkcs7 -print_certs -in certificate.p7b -out certificate.pem`

can anyone please let me know how to enable https on elasticsearch if it's free

---

<div class="post-metadata">

### Author: ![abhishek13](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abhishek13](https://discuss.elastic.co/u/abhishek13)
#### Post date: [July 23, 2019, 1:38pm UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753/3 "2019-07-23T13:38:44Z")

</div>

can anyone please let me know how to enable https on elasticsearch if it's free.

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [July 25, 2019, 12:33pm UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753/4 "2019-07-25T12:33:02Z")

</div>

Hi @abhishek13 🙂

I guess that you have already checked the docs but maybe this blog post can also help you:

> **[How to setup TLS for Elasticsearch, Kibana, Logstash and Filebeat with...](https://www.elastic.co/blog/how-to-setup-tls-for-elasticsearch-kibana-logstash-filebeat-with-offline-install-in-linux)**
>
> How to transmit fully-encrypted log data from Filebeat to logstash to elasticsearch to kibana, along with offline install, in Linux OS.

---

<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: [August 22, 2019, 12:33pm UTC](https://discuss.elastic.co/t/metricbeat-not-able-to-connect-with-x-pack-enabled-elastic/191753/5 "2019-08-22T12:33:05Z")

</div>

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