简体   繁体   中英

Logstash failed to put logs to elasticsearch

I'm trying to setup ELK environment to analysis my logs.
All of 3 tools are in one server, the ip is 192.168.1.114
and here's my logstash config:

input {
  file {
    path => "/usr/local/websrv/tomcat/logs/catalina.out"
  }
}

output {
  elasticsearch {
    hosts => ["127.0.0.1:9200"]
  }
}

That works, however, when I changed hosts from ["127.0.0.1:9200"] to ["192.168.1.114:9200"] , errors happened. I got below messages from logstash.

Attempted to send a bulk request to Elasticsearch configured at '[" http://192.168.1.114:9200/ "]', but Elasticsearch appears to be unreachable or down! {:client_config=>{:hosts=>[" http://192.168.1.114:9200/ "], :ssl=>nil, :transport_options=>{:socket_timeout=>0, :request_timeout=>0, :proxy=>nil, :ssl=>{}}, :transport_class=>Elasticsearch::Transport::Transport::HTTP::Manticore, :logger=>nil, :tracer=>nil, :reload_connections=>false, :retry_on_failure=>false, :reload_on_failure=>false, :randomize_hosts=>false}, :error_message=>"Connection refused", :class=>"Manticore::SocketException", :level=>:error}

Could some one advise? Thanks a lot.

If you're using ES 2.0, this is because ES binds to localhost by default .

In order to change that, you simply need to change the following settings in your elasticsearch.yml configuration file and restart ES:

network.bind_host: 192.168.1.114

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM