# Logstash 401 error

**URL:** <https://discuss.elastic.co/t/logstash-401-error/301247>\
**Category:** Logstash\
**Created:** [March 31, 2022, 7:35pm UTC](https://discuss.elastic.co/t/logstash-401-error/301247 "2022-03-31T19:35:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaishiqi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chaishiqi/32/100441_2.png) [@chaishiqi](https://discuss.elastic.co/u/chaishiqi)\
**Post date:** [March 31, 2022, 7:35pm UTC](https://discuss.elastic.co/t/logstash-401-error/301247/1 "2022-03-31T19:35:19Z")

</div>

Here is my logstash config:

```auto
input {
  file {
    path => "/var/log/nginx/access.log"
    codec => "json"
  }
}
output {
  elasticsearch {
    hosts => ["https://10.0.5.132:9200"]
    ssl => true
    cacert => "/etc/logstash/logstash.crt"
    user => "logstash"
    password => "xxx"
    index => "nginx-%{+yyyy.MM.dd}"
    ilm_rollover_alias => "nginx"
    ilm_pattern => "{now/d}-00001"
    ilm_policy => "test"
  }
}

```

When I start logstash, error occurs

```auto
Mar 31 19:21:41 ip-10-0-5-152 logstash[5757]: [2022-03-31T19:21:41,513][WARN][org.logstash.execution.ShutdownWatcherExt] {"inflight_count"=>0, "stalling_threads_info"=>{"other"=>[{"thread_id"=>31, "name"=>"[main]>worker0", "current_call"=>"[...]/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:95:in `sleep'"}, {"thread_id"=>32, "name"=>"[main]>worker1", "current_call"=>"[...]/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:89:in `sleep'"}, {"thread_id"=>33, "name"=>"[main]>worker2", "current_call"=>"[...]/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:95:in `sleep'"}, {"thread_id"=>34, "name"=>"[main]>worker3", "current_call"=>"[...]/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:95:in `sleep'"}]}}
Mar 31 19:21:42 ip-10-0-5-152 logstash[5757]: [2022-03-31T19:21:42,232][WARN][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://10.0.5.132:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'https://10.0.5.132:9200/'"}

```

But I curl it success

```auto
root@ip-10-0-5-152:~# curl -H "Content-Type: application/json" --user logstash:xxx --cacert /etc/logstash/logstash.crt -XGET https://10.0.5.132:9200/_cat/nodes
10.0.5.132 23 87 3 0.00 0.02 0.05 hilmst - node_hot
10.0.5.168 44 82 0 0.00 0.00 0.00 chm * node_frozen
10.0.5.174 47 82 0 0.00 0.00 0.00 cm - node_cold

```

What's the problem?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 31, 2022, 11:29pm UTC](https://discuss.elastic.co/t/logstash-401-error/301247/2 "2022-03-31T23:29:00Z")

</div>

That's a warning, not an error, so it should retry and succeed.

Is there more to the log?

---

<div class="post-metadata">

**Author:** ![chaishiqi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chaishiqi/32/100441_2.png) [@chaishiqi](https://discuss.elastic.co/u/chaishiqi)\
**Post date:** [April 1, 2022, 6:28am UTC](https://discuss.elastic.co/t/logstash-401-error/301247/3 "2022-04-01T06:28:08Z")

</div>

No more log, only this two lines recycle, index not written successful

---

<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 29, 2022, 6:28am UTC](https://discuss.elastic.co/t/logstash-401-error/301247/4 "2022-04-29T06:28:09Z")

</div>

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