不幸的是,Logstash不會嘗試在正確的IP地址輸出到Elasticsearch。 Elasticsearch配置在端口9200上的私有IP地址.Logstash正嘗試在localhost:9200處輸出到Elasticsearch。這顯示在下面的日誌中。如何讓logstash輸出到privatesearch上的elasticsearch?
{:timestamp=>"2016-02-08T16:27:58.572000-0500", :message=>"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}
我的配置文件如下: /etc/elasticsearch/elasticsearch.yml
network.host: PRIVATE_IP_ADDRESS
/opt/logstash/conf.d/logstash.conf
input {
beats {
port => 5044
}
}
output {
elasticsearch {
hosts => ["PRIVATE_IP_ADDRESS:9200"]
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}
我有/etc/logstash/conf.d/logstash.conf中的相同文件,因爲我不知道在哪裏放置logstash配置文件。
當我運行curl PRIVATE_IP_ADDRESS:9200
,我得到下面的輸出
{
"name" : "Gabriel Summers",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.1.1",
"build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
"build_timestamp" : "2015-12-15T13:05:55Z",
"build_snapshot" : false,
"lucene_version" : "5.3.1"
},
"tagline" : "You Know, for Search"
}
如何配置Logstash輸出到Elasticsearch在PRIVATE_IP_ADDRESS:9200不是本地主機:92000?
您能指出您是如何安裝logstash(rpm,deb,tarball)以及如何啓動它的?順便說一下,我強烈建議您更改elasticsearch集羣名稱,因爲連接到相同LAN的任何夥伴都可能加入您的集羣。 – devlearn
我用rpm來安裝Logstash。謝謝你的建議。我現在要做。 –