# Metricbeat 401 error after enabling TLS

**URL:** <https://discuss.elastic.co/t/metricbeat-401-error-after-enabling-tls/281986>\
**Category:** Beats\
**Created:** [August 19, 2021, 3:00pm UTC](https://discuss.elastic.co/t/metricbeat-401-error-after-enabling-tls/281986 "2021-08-19T15:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greg_r/32/92845_2.png) [@Greg\_R](https://discuss.elastic.co/u/Greg_R)\
**Post date:** [August 19, 2021, 3:00pm UTC](https://discuss.elastic.co/t/metricbeat-401-error-after-enabling-tls/281986/1 "2021-08-19T15:00:00Z")

</div>

Greetings  
I've setup ElasticSearch, Kibana and Metricbeat on http and it's working.  
Now I want to enable API keys, so I have to enable TLS (although I don't understand why).  
So I got ES and Kibana working together, but Metricbeat cannot connect:

```auto
Error fetching data for metricset kibana.stats: HTTP error 401 in : 401 Unauthorized

```

I've tried to use the "elastic" user and to create a specific user, no success...

What should I do to connect Metricbeat to Kibana?

Thanks in advance

Regards

GR

---

<div class="post-metadata">

**Author:** ![MarianaD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marianad/32/42687_2.png) [@MarianaD](https://discuss.elastic.co/u/MarianaD)\
**Post date:** [August 25, 2021, 11:14am UTC](https://discuss.elastic.co/t/metricbeat-401-error-after-enabling-tls/281986/2 "2021-08-25T11:14:44Z")

</div>

hi @Greg_R , how does the metricbeat configuration looks like now after enabling TLS? Have you followed the steps here [Secure communication with Elasticsearch | Metricbeat Reference [7.14] | Elastic](https://www.elastic.co/guide/en/beats/metricbeat/current/securing-communication-elasticsearch.html)?

---

<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:** [September 22, 2021, 11:15am UTC](https://discuss.elastic.co/t/metricbeat-401-error-after-enabling-tls/281986/3 "2021-09-22T11:15:08Z")

</div>

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