# Error importing URL/file: Failed to import index-pattern: : error loading /tmp/tmp401063577/beats-dashboards-5.4.0/filebeat/index-pattern/filebeat.json: couldn't load json. Error: 401 Unauthorized

**URL:** <https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 17, 2017, 5:11pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461 "2017-08-17T17:11:54Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![sandy007](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandy007/32/21225_2.png) [@sandy007](https://discuss.elastic.co/u/sandy007)\
**Post date:** [August 18, 2017, 7:06pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/21 "2017-08-18T19:06:20Z")

</div>

Hello Parth,

I am still getting the below error logs in filebeat logs -

tail -f /var/log/filebeat/filebeat  
2017-08-19T00:34:00+05:30 INFO Start sending events to output  
2017-08-19T00:34:00+05:30 INFO Harvester started for file: /var/log/filebeat/filebeat  
2017-08-19T00:34:00+05:30 INFO Harvester started for file: /var/log/messages  
2017-08-19T00:34:05+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:34:06+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:34:08+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:34:12+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:34:20+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:34:30+05:30 INFO Non-zero metrics in the last 30s: filebeat.harvester.open\_files=2 filebeat.harvester.running=2 filebeat.harvester.started=2 libbeat.es.publish.read\_bytes=1965 libbeat.es.publish.write\_bytes=615 libbeat.publisher.published\_events=277  
2017-08-19T00:34:36+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:35:00+05:30 INFO Non-zero metrics in the last 30s: libbeat.es.publish.read\_bytes=393 libbeat.es.publish.write\_bytes=123  
2017-08-19T00:35:08+05:30 ERR Connecting error publishing events (retrying): 401 Unauthorized  
2017-08-19T00:35:30+05:30 INFO Non-zero metrics in the last 30s: libbeat.es.publish.read\_bytes=393 libbeat.es.publish.write\_bytes=123

What couldbe the problem. Due to that My kibana stopped showing logs

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [August 20, 2017, 4:59pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/22 "2017-08-20T16:59:40Z")

</div>

The http response `401 Unauthorized` means you are missing username and password.

---

<div class="post-metadata">

**Author:** ![sandy007](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandy007/32/21225_2.png) [@sandy007](https://discuss.elastic.co/u/sandy007)\
**Post date:** [August 21, 2017, 4:29pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/23 "2017-08-21T16:29:18Z")

</div>

where i need to define the username and password in filebeat to avoid this error message.? Please guide me. I have been playing with this error since last week and still no solution.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [August 22, 2017, 1:49pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/24 "2017-08-22T13:49:05Z")

</div>

Add username and password to the elasticsearch output (See [the documentation](https://www.elastic.co/guide/en/beats/filebeat/current/securing-communication-elasticsearch.html#securing-communication-elasticsearch) and [Elasticsearch output docs](https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html#elasticsearch-output)).

---

<div class="post-metadata">

**Author:** ![sandy007](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandy007/32/21225_2.png) [@sandy007](https://discuss.elastic.co/u/sandy007)\
**Post date:** [August 29, 2017, 5:43am UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/25 "2017-08-29T05:43:38Z")

</div>

Thanks steffen,

It worked .. Appreciate your help. I am trying to configure email account in elk.yml file but it keep failing to send the email through wachter .. if i send email from servers root to my email .. it worked but not through the x-pack..not sure what i am doing wrong.below is my email config --

===========================

#"actions" : {

# "send\_email" : {

# "email" : {

# "to" : "aryaa.sandip@gmail.com",

# "subject" : "Watcher Notification",

# "body" : "{{ctx.payload.hits.total}} error logs found"

# }

# }

#}  
xpack.notification.email.account:  
smtp\_account:  
profile: standard  
smtp:  
auth: false  
starttls.enable: false  
host: [appmgt-5.in.ibm.com](http://appmgt-5.in.ibm.com)  
port: 25

===========================

Thanks,  
Sandy

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [August 29, 2017, 12:14pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/26 "2017-08-29T12:14:01Z")

</div>

Uhm, for issues with watcher better ask in the X-Pack forums. Also include logs. Just from configs it's hard to tell what's going wrong.

---

<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 26, 2017, 12:19pm UTC](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461/27 "2017-09-26T12:19:58Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/error-importing-url-file-failed-to-import-index-pattern-error-loading-tmp-tmp401063577-beats-dashboards-5-4-0-filebeat-index-pattern-filebeat-json-couldnt-load-json-error-401-unauthorized/97461.md?page=1)
