简体   繁体   English

Logstash无法将日志放入elasticsearch

[英]Logstash failed to put logs to elasticsearch

I'm trying to setup ELK environment to analysis my logs. 我正在尝试设置ELK环境来分析我的日志。
All of 3 tools are in one server, the ip is 192.168.1.114 3种工具全部位于一台服务器中,其IP为192.168.1.114
and here's my logstash config: 这是我的logstash配置:

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. 可行,但是,当我将主机从[“ 127.0.0.1:9200”]更改为[“ 192.168.1.114:9200”]时 ,发生了错误。 I got below messages from logstash. 我从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! 尝试向配置为'[“ http://192.168.1.114:9200/ ”]'的Elasticsearch发送批量请求,但Elasticsearch似乎无法访问或关闭! {: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} {: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 =>“拒绝连接”,: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 . 如果您使用的是ES 2.0,这是因为默认情况下 ES 绑定到localhost

In order to change that, you simply need to change the following settings in your elasticsearch.yml configuration file and restart ES: 为了更改此设置,您只需要在elasticsearch.yml配置文件中更改以下设置并重新启动ES:

network.bind_host: 192.168.1.114

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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