2015-08-25 77 views
2

我使用Logstash 1.5.4和1.7.1 ElasticsearchLogstash輸入

以下是我Logstash配置文件:

input { 
     elasticsearch { 
       host => localhost 
     } 
} 


output { 
     elasticsearch { 
       host => localhost 
     } 
     stdout { 
       codec => rubydebug 
     } 
} 

這工作得很好,當我不包括Elasticsearch輸入的'主機'選項。但是,一旦我添加它,它給了我下面的錯誤並關閉Logstash關:

←[31mUnknown setting 'host' for elasticsearch {:level=>:error}←[0m 
Error: Something is wrong with your configuration. 
You may be interested in the '--configtest' flag which you can 
use to validate logstash's configuration before you choose 
to restart a running system. 

現在我知道,使用主機是可選的,但我需要它。如果後來我想要一個來自其他localhost的主機的elasticsearch輸入呢?請幫忙。

謝謝。

回答

5

elasticsearch輸入中,要使用的正確參數名稱是hosts而不是host

input { 
     elasticsearch { 
       hosts => "localhost" 
     } 
} 
... 

所以host實際上是一個文檔錯誤。 elasticsearch input plugin的Ruby源代碼也講述了同樣的故事。

+0

謝謝,就是這樣。爲什麼在文檔的第一個示例中沒有提到這個問題! https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html –

+0

文檔錯誤,我猜;) – Val

+0

要注意,在輸出中它應該只是「主機」,而不是「主機「對於Logstash 1.5。 https://www.elastic.co/guide/en/logstash/1.5/configuration.html – vvs14