# Filebeat template with authentication

**URL:** https://discuss.elastic.co/t/filebeat-template-with-authentication/124989
**Category:** Beats
**Tags:** filebeat
**Created:** [March 21, 2018, 12:51pm UTC](https://discuss.elastic.co/t/filebeat-template-with-authentication/124989 "2018-03-21T12:51:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tommy.walker](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@tommy.walker](https://discuss.elastic.co/u/tommy.walker)
#### Post date: [March 21, 2018, 12:51pm UTC](https://discuss.elastic.co/t/filebeat-template-with-authentication/124989/1 "2018-03-21T12:51:33Z")

</div>

I have just stood up separate elastic, logstash and kibana servers. All running 6.2.  
I have filebeats 6.2 running on windows 2016 server running iis v10. I have the iis logs successfully sending to logstash and i can see the logstash index in elasticsearch.  
My problem is getting the filebeats template from my windows server to elasticsearch. When i run the following command :  
.\filebeat.exe setup --template -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["10.200.0.210:9200"]'  
I get the follwoing error message:  
Exiting: Couldn't connect to any of the configured Elasticsearch hosts. Errors: [Error connection to Elasticsearch [http://10.200.0.210:9200](http://10.200.0.210:9200): 401 Unauthorized: {"error":{"root\_cause":[{"type":  
"security\_exception","reason":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}}],"type":"security\_exception","rea  
son":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}},"status":401}]

Im trying to figure out how to pass the user creds in the command but am not having any luck.

---

<div class="post-metadata">

### Author: ![tudor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tudor/32/3753_2.png) [@tudor](https://discuss.elastic.co/u/tudor)
#### Post date: [March 21, 2018, 8:27pm UTC](https://discuss.elastic.co/t/filebeat-template-with-authentication/124989/2 "2018-03-21T20:27:05Z")

</div>

It should be something like `-E "output.elasticsearch.user=<username>"-E "output.elasticsearch.password=<password>"`. Or putting them in the URL should also work.

---

<div class="post-metadata">

### Author: ![tommy.walker](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@tommy.walker](https://discuss.elastic.co/u/tommy.walker)
#### Post date: [March 22, 2018, 8:57pm UTC](https://discuss.elastic.co/t/filebeat-template-with-authentication/124989/3 "2018-03-22T20:57:39Z")

</div>

Thanks for your reply. I finally got it to work yesterday by modifying my filebeat.yml file as described in the documentation. Apparently, I was able to pass the creds via the .yml .

---

<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: [April 19, 2018, 8:57pm UTC](https://discuss.elastic.co/t/filebeat-template-with-authentication/124989/4 "2018-04-19T20:57:40Z")

</div>

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