我想将ELK堆栈用于rails上的应用程序。 Logstash标准配置:
input { stdin { } }
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
elasticsearch { hosts => ["localhost:9200"] }
stdout { codec => rubydebug }
}
当我在终端(cat development.log | nice bin/logstash -f logstash.conf
)中执行命令时,会发生以下错误:
Connection refused {:class=>"Manticore::SocketException", :level=>:error}
Connection refused {:class=>"Manticore::SocketException", :level=>:error}
Settings: Default pipeline workers: 2
Connection refused {:class=>"Manticore::SocketException", :level=>:error}
Connection refused {:class=>"Manticore::SocketException", :level=>:error}
Logstash startup completed
Attempted to send a bulk request to Elasticsearch configured at '["http://localhost:9200/"]', but Elasticsearch appears to be unreachable or down! {:client_config=>{:hosts=>["http://localhost: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}
可能是什么问题?
答案 0 :(得分:1)
拒绝连接表示Logstash无法连接到Elasticsearch。
有三个可能的原因:
network.host=0.0.0.0
绑定到所有地址)基本诊断应该告诉你是什么情况。 netstat -an | grep 9200
查看Elasticsearch是否正在运行并绑定到特定地址。 getenforce
查看SELinux是否已启用。