Logstash Connection Refused by Elasticsearch Over Proxy or AIC


We faced connection refused issue if  trying to Logstash output data to Elasticsearch over HTTP that happen because of Proxy configuration or if Elasticsearch on cloud environment.

Generally we faced below exception

[2017-04-24T10:45:32,933][WARN ][logstash.outputs.elasticsearch] UNEXPECTED POOL ERROR {:e=>#<LogStash::Outputs::ElasticSearch::HttpClient::Pool::NoConnectionAvailableError: No Available connections>}
[2017-04-24T10:45:32,934][ERROR][logstash.outputs.elasticsearch] Attempted to send a bulk request to elasticsearch, but no there are no living connections in the connection pool. Perhaps Elasticsearch is unreachable or down? {:error_message=>"No Available connections", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::NoConnectionAvailableError", :will_retry_in_second
Logstash allow proxy declaration in configuration file for Elasticsearch Output as given below in field proxy. For user userid and password is having any special symbol than you have to use ASCII value. For example my password is music@123 then after converting to ASCII value for that is %40 my password become music%40123. Refer this link ASCII CODE for getting ASCII value corresponding to each character.
proxy => "http://userid:passowrd@proxyhost:8080"

For  example my userid and password is “smart” and “music@123” below proxy configuration like

proxy => "http://smart:music%40123@proxyhost:8080"

How to set Proxy in Logstash Configuration for Elasticsearch Output?

output {
    elasticsearch {
       index => "app1-logs-%{+YYYY.MM.dd}"
       proxy => "http://smart:music%40123@proxyhost:8080"
       hosts => ["elasticServerHost:elasticServerPort"]
       }
}

Issues Solution

For more Logstash issues solution follow link Common Logstash Issues.

About Saurabh Gupta

My Name is Saurabh Gupta, I have approx. 10 Year of experience in Information Technology World manly in Java/J2EE. During this time I have worked with multiple organization with different client, so many technology, frameworks etc.
This entry was posted in Logstash and tagged , , , , , . Bookmark the permalink.